matovsky
OP
Created
Replies
5
Boosts
0
Views
837
Participants
2
Could you show the code where the error occurs ?
Where are you using '[CKRecord]'
@Published var checkedInProfiles: [CKRecord.ID: Int] = [:] ...
func getCheckedInCounts() { ckController.database.fetchCheckedInProfilesCount(with: RecordType.profile) { (results, moreComing, error) in DispatchQueue.main.async { [self] in checkedInProfiles = results } } }
Thanks for the code. Comments are messing code presentation, it is better to post in a new reply:
@Published var checkedInProfiles: [CKRecord.ID: Int] = [:]
func getCheckedInCounts() {
ckController.database.fetchCheckedInProfilesCount(with: RecordType.profile) { (results, moreComing, error) in
DispatchQueue.main.async { [self] in
checkedInProfiles = results
}
}
}
So I assume you get the error in
checkedInProfiles = results
Most likely, results in fetchCheckedInProfilesCount is a [CKRecord], hence a mismatch.
Could you confirm by showing fetchCheckedInProfilesCount func ?
Thank you very much! I got another problem: Cast from '[AnyObject]' to unrelated type '[CKRecord.ID : Int]' always fails
Here:
operation.queryCompletionBlock = { (cursor, error) in
let moreComing = (cursor == nil) ? false : true
completionHandler(results as [AnyObject] as! [CKRecord.ID: Int], moreComing, error as NSError?)
if let cursor = cursor {
self.continueCheckedInProfilesCount(with: cursor, results: results, completionHandler: completionHandler)
}
}
Closed