I am also getting the same error as mliu, when running the sample code from the iOS CouchbaseList setup documentation.
XCode 9, iOS 11, CBlite 1.4, CBgateway 1.5. Running from Simulator pointing to a local instance of sync_gateway.
https://developer.couchbase.com/documentation/mobile/1.4/installation/ios/index.html
Can you explain how couchbase interacts with the device KeyChain under the hood?
Is the issue that CBLite is trying to write credentials to the KeyChain but receives the “errSecItemNotFound”?
Do you have any suggestions on how to dump the contents of the KeyChain?
Logs with “SyncVerbose” enabled:
13:05:06.889| Couchbase Lite using SQLite version 3.19.3 (2017-06-27 16:48:08 2b0954060fe10d6de6d479287dd88890f1bef6cc1beca11bc6cdb79f72e2377b)
13:05:06.892| SQLite message: recovered 94 frames from WAL file /Users/andrew/Library/Developer/CoreSimulator/Devices/BC24806C-4FD1-4FCA-A1D4-AEC9733DA68B/data/Containers/Data/Application/C659EDC9-C7DF-4F8F-AE45-0945D02CC8D3/Library/Application Support/CouchbaseLite/app.cblite2/db.sqlite3-wal
Document ID :: -rws4A3BRci6p8bpNJ1226u
Learning iOS
13:05:06.916| Sync: CBLReplication[to http://localhost:4984/hello]: offline, progress = 0 / 0, err: (null)
13:05:06.916| Sync: CBLReplication[from http://localhost:4984/hello]: offline, progress = 0 / 0, err: (null)
13:05:06.918‖ Sync: CBLRestPusher[http://localhost:4984/hello] STARTING ...
2017-10-30 13:05:06.919626-0600 CouchBaseExample[29749:3630211] CredStore - performQuery - Error copying matching creds. Error=-25300, query={
atyp = http;
class = inet;
"m_Limit" = "m_LimitAll";
ptcl = http;
"r_Attributes" = 1;
srvr = localhost;
sync = syna;
}
13:05:06.926‖ Sync: CBLRestPusher[http://localhost:4984/hello]: Reachability state = <localhost>:reachable (02), suspended=0
13:05:06.930‖ Sync: CBLRestPusher[http://localhost:4984/hello]: Going online
13:05:06.931‖ Sync: CBLRestPusher[http://localhost:4984/hello]: No local checkpoint; not getting remote one
13:05:06.931‖ Sync: CBLRestPusher[http://localhost:4984/hello]: Received 8 revs
13:05:06.931‖ Sync: CBLRestPusher[http://localhost:4984/hello] Progress: set active = 1
13:05:06.931‖ Sync: CBLRestPusher[http://localhost:4984/hello]: postProgressChanged (0/0, active=1 (batch=8, net=0), lastSeq=(null), online=1, error=(null))
13:05:06.931‖ Sync: *** CBLRestPusher[http://localhost:4984/hello]: BEGIN processInbox (8 sequences)
13:05:06.932‖ Sync: <CBLRemoteSession: 0x60000008edd0>: POST /hello/_revs_diff
13:05:06.933‖ Sync: *** CBLRestPusher[http://localhost:4984/hello]: END processInbox (lastSequence=(null))
13:05:06.933‖ Sync: CBLRestPusher[http://localhost:4984/hello]: postProgressChanged (0/0, active=1 (batch=0, net=1), lastSeq=(null), online=1, error=(null))
13:05:06.933| Sync: CBLReplication[to http://localhost:4984/hello]: active, progress = 0 / 0, err: (null)
13:05:06.933‖ Sync: CBLRestPuller[http://localhost:4984/hello] STARTING ...
2017-10-30 13:05:06.945017-0600 CouchBaseExample[29749:3630211] CredStore - performQuery - Error copying matching creds. Error=-25300, query={
atyp = http;
class = inet;
"m_Limit" = "m_LimitAll";
ptcl = http;
"r_Attributes" = 1;
srvr = localhost;
sync = syna;
}
13:05:06.946‖ Sync: CBLRestPuller[http://localhost:4984/hello]: Reachability state = <localhost>:reachable (02), suspended=0
13:05:06.947‖ Sync: CBLRestPuller[http://localhost:4984/hello]: Going online
13:05:06.947‖ Sync: CBLRestPuller[http://localhost:4984/hello]: No local checkpoint; not getting remote one
13:05:06.947‖ Sync: CBLRestPuller[http://localhost:4984/hello] Progress: set active = 1
13:05:06.947‖ Sync: CBLRestPuller[http://localhost:4984/hello]: postProgressChanged (0/0, active=1 (batch=0, net=1), lastSeq=(null), online=1, error=(null))
13:05:06.947‖ Sync: CBLRestPuller[http://localhost:4984/hello] starting ChangeTracker: mode=0, since=(null)
13:05:06.948‖ Sync: CBLSocketChangeTracker[0x6040001a0ee0 hello]: POST //localhost:4984/hello/_changes?feed=normal&heartbeat=300000&style=all_docs
2017-10-30 13:05:06.969079-0600 CouchBaseExample[29749:3630177] CredStore - performQuery - Error copying matching creds. Error=-25300, query={
atyp = http;
class = inet;
"m_Limit" = "m_LimitAll";
ptcl = http;
"r_Attributes" = 1;
sdmn = "Couchbase Sync Gateway";
srvr = localhost;
sync = syna;
}
13:05:07.038‖ Sync: CBLRestPuller[http://localhost:4984/hello]: postProgressChanged (0/0, active=1 (batch=0, net=1), lastSeq=(null), online=1, error=(null))
13:05:07.038| Sync: CBLReplication[from http://localhost:4984/hello]: active, progress = 0 / 0, err: (null)
2017-10-30 13:05:07.040957-0600 CouchBaseExample[29749:3630211] CredStore - performQuery - Error copying matching creds. Error=-25300, query={
atyp = http;
class = inet;
"m_Limit" = "m_LimitAll";
ptcl = http;
"r_Attributes" = 1;
sdmn = "Couchbase Sync Gateway";
srvr = localhost;
sync = syna;
}
13:05:07.051‖ Sync: CBLRestPusher[http://localhost:4984/hello]: Server is Couchbase Sync Gateway/1.5.0
2017-10-30 13:05:07.056132-0600 CouchBaseExample[29749:3630211] CredStore - performQuery - Error copying matching creds. Error=-25300, query={
atyp = http;
class = inet;
"m_Limit" = "m_LimitAll";
ptcl = http;
"r_Attributes" = 1;
sdmn = "Couchbase Sync Gateway";
srvr = localhost;
sync = syna;
}
13:05:07.056‖ <BLIPHTTPLogic: 0x60400008f550>: HTTP auth failed; sent Authorization: (null) ; got WWW-Authenticate: Basic realm="Couchbase Sync Gateway"
13:05:07.057‖ CBLSocketChangeTracker[0x6040001a0ee0 hello]: Can't connect, giving up: CBLHTTP[401, <http://localhost:4984/hello/_changes?feed=normal&heartbeat=300000&style=all_docs>]<--NSURLError[-1013, <http://localhost:4984/hello/_changes?feed=normal&heartbeat=300000&style=all_docs>]
13:05:07.057‖ Sync: CBLRestPuller[http://localhost:4984/hello]: ChangeTracker stopped; error=CBLHTTP[401, <http://localhost:4984/hello/_changes?feed=normal&heartbeat=300000&style=all_docs>]<--NSURLError[-1013, <http://localhost:4984/hello/_changes?feed=normal&heartbeat=300000&style=all_docs>]
13:05:07.079‖ Sync: CBLRestPuller[http://localhost:4984/hello] Progress: set error = CBLHTTP[401, <http://localhost:4984/hello/_changes?feed=normal&heartbeat=300000&style=all_docs>]<--NSURLError[-1013, <http://localhost:4984/hello/_changes?feed=normal&heartbeat=300000&style=all_docs>]
13:05:07.079‖ Sync: CBLRestPuller[http://localhost:4984/hello] STOPPING...
13:05:07.079‖ Sync: CBLRestPuller[http://localhost:4984/hello] Progress: set active = 0
13:05:07.079‖ Sync: CBLRestPuller[http://localhost:4984/hello]: postProgressChanged (0/0, active=0 (batch=0, net=0), lastSeq=(null), online=1, error=CBLHTTP[401, <http://localhost:4984/hello/_changes?feed=normal&heartbeat=300000&style=all_docs>]<--NSURLError[-1013, <http://localhost:4984/hello/_changes?feed=normal&heartbeat=300000&style=all_docs>])
13:05:07.079‖ Sync: CBLRestPuller[http://localhost:4984/hello] STOPPED
13:05:07.079‖ Replication: CBLRestPuller[http://localhost:4984/hello] took 0.134 sec; error=CBLHTTP[401, <http://localhost:4984/hello/_changes?feed=normal&heartbeat=300000&style=all_docs>]<--NSURLError[-1013, <http://localhost:4984/hello/_changes?feed=normal&heartbeat=300000&style=all_docs>]
13:05:07.085| Sync: CBLReplication[from http://localhost:4984/hello]: stopped, progress = 0 / 0, err: CBLHTTP[401, <http://localhost:4984/hello/_changes?feed=normal&heartbeat=300000&style=all_docs>]<--NSURLError[-1013, <http://localhost:4984/hello/_changes?feed=normal&heartbeat=300000&style=all_docs>]
13:05:07.085‖ CBLRemoteJSONRequest[POST http://localhost:4984/hello/_revs_diff]: Got error CBLHTTP[401, "Login required", <http://localhost:4984/hello/_revs_diff>]
13:05:07.085‖ Sync: CBLRestPusher[http://localhost:4984/hello] Progress: set error = CBLHTTP[401, "Login required", <http://localhost:4984/hello/_revs_diff>]
13:05:07.085‖ Sync: CBLRestPusher[http://localhost:4984/hello] STOPPING...
13:05:07.085‖ Sync: CBLRestPusher[http://localhost:4984/hello] Progress: set active = 0
13:05:07.085‖ Sync: CBLRestPusher[http://localhost:4984/hello]: postProgressChanged (0/0, active=0 (batch=0, net=0), lastSeq=(null), online=1, error=CBLHTTP[401, "Login required", <http://localhost:4984/hello/_revs_diff>])
13:05:07.104‖ Sync: CBLRestPusher[http://localhost:4984/hello] STOPPED
13:05:07.105‖ Replication: CBLRestPusher[http://localhost:4984/hello] took 0.182 sec; error=CBLHTTP[401, "Login required", <http://localhost:4984/hello/_revs_diff>]
13:05:07.105| Sync: CBLReplication[to http://localhost:4984/hello]: stopped, progress = 0 / 0, err: CBLHTTP[401, "Login required", <http://localhost:4984/hello/_revs_diff>]
Thanks,
Andrew