I working in app using CloudKit. I'm implement a way to get deltas from CloudKit to my app (I'm using the public database). I get a response back from fetchNotificationChangesCompletionBlock block but I don't get a response back from notificationChangedBlock.
Here is my code:
-(void)checkForNewData
{
CKServerChangeToken *token = [[cloudKitToken helper] getCloudKitToken];
CKFetchNotificationChangesOperation *op = [[CKFetchNotificationChangesOperation alloc]
initWithPreviousServerChangeToken:token];
NSMutableArray *noteIds = [[NSMutableArray alloc] init];
op.notificationChangedBlock = ^(CKNotification *note)
{
CKNotificationID *noteId = note.notificationID;
[noteIds addObject:noteId];
if([note isKindOfClass:[CKQueryNotification class]]) {
CKQueryNotification *qNote = (CKQueryNotification *)note;
CKRecordID *changedRecordID = qNote.recordID;
NSLog(@"I got CKQueryNotification");
}
};
op.fetchNotificationChangesCompletionBlock = ^(CKServerChangeToken *token, NSError *error) {
NSLog(@"error %@", error.localizedDescription);
};
[[CKContainer defaultContainer] addOperation:op];
}
Any of you knows what I'm doing wrong or what is wrong with my code?
I'll really appreciate your help.