我已经尝试了很多事情,但似乎无法从来自 cloudKit 的通知中重置徽章计数。有没有其他人遇到过这个问题。这是我尝试过的:
1)在本地设置徽章计数为0
application.applicationIconBadgeNumber = 0; (temporarily removes the badge count).
没运气...
2)调用服务器清除徽章计数
CKModifyBadgeOperation *oper = [[CKModifyBadgeOperation alloc] initWithBadgeValue:0];
[oper start];
没运气...
3) 拉入所有通知更改并将它们全部标记为已读
NSMutableArray *array = [NSMutableArray array];
CKFetchNotificationChangesOperation *operation = [[CKFetchNotificationChangesOperation alloc] initWithPreviousServerChangeToken:nil];
operation.notificationChangedBlock = ^(CKNotification *notification) {
[array addObject:notification.notificationID];
};
operation.completionBlock = ^{
CKMarkNotificationsReadOperation *op = [[CKMarkNotificationsReadOperation alloc] initWithNotificationIDsToMarkRead:array];
[op start];
};
[operation start];
再次没有运气......
任何建议将不胜感激!谢谢,克里斯