I'm testing with three iDevices. Device 1 fires CKSubscription change notification.
Device 2 and 3 receives the notification and the badge number increases to 1.
I coded to reset the badge number to 0 everytime app comes to foreground like below.(in applicationDidBecomeActive:)
CKModifyBadgeOperation *badgeResetOperation = [[CKModifyBadgeOperation alloc] initWithBadgeValue:0];
[badgeResetOperation setModifyBadgeCompletionBlock:^(NSError * operationError) {
if (!operationError) {
[UIApplication sharedApplication].applicationIconBadgeNumber = 0;
}
}];
[[CKContainer defaultContainer] addOperation:badgeResetOperation];
If user taps my app on device 2, above code will be executed. It works well. The badge number is reset to 0. But the issue is that badge number on device 3 also become 0 simultaneously, even though I didn't tap my app on device 3.
I hope that device 3 remains with increased badge number since user didn't tap it.
API Reference says 'This operation object can update the badge for the current device or for all of the user’s devices.'
https://developer.apple.com/reference/cloudkit/ckmodifybadgeoperation?language=objc
I believe it means that there's a way to reset only a single device I want.
Please anybody guide me how to accomplish it.