CloudKit Requests for Registered Users
So according to Apple's documentation, non-iCloud users are still allowed to read from public databases, but I get the following error when querying the open database:
Domain Error = NSCocoaErrorDomain Code = 4097 "The operation could not be completed. (Cocoa error 4097.)" (connecting to service named com.apple.cloudd) UserInfo = 0x7c3498c0 {NSDebugDescription = connecting to service named com.apple.cloudd}
Here's my code for reference:
let container = CKContainer.defaultContainer()
let database = container.publicCloudDatabase
let predicate = NSPredicate(value: true)
let episodeQuery = CKQuery(recordType: "Episode", predicate: predicate)
database.performQuery(episodeQuery, inZoneWithID: nil) {
// Record handling goes here
}
Any thoughts, advice or advice would definitely be appreciated. Many thanks
source to share
Error 4097 is returned when your application is unable to talk to cloudd, the CloudKit daemon.
This could be due to a permissions issue or a bug in cloudd. Check your syslog for more hints and look for the crash logs from cloudd. If you have a cloud mode crash log, attach it to the new radar at bugreport.apple.com
source to share
I had a similar problem - after checking the syslog as suggested by @farktronix, after filtering with, cloudd
I saw:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Unexpected expression: NSSelfExpression'
It turns out that my query predicate was wrong - in my subscription request, I was trying to use the predicate:
NSPredicate(format: "self = %@", someCKRecord)
whereas I had to use
NSPredicate(format: "recordID = %@", someCKRecord.recordID)
source to share