I have recently added iCloud into my iOS15, when I want to reset badge notifications with CKModifyBadgeOperation(badge:0)
, I have this warning:
'CKModifyBadgeOperation' was deprecated in iOS 11.0: No longer supported, will cease working at some point in the future
Is there another way?
func notificationsBadgeReset(){
let badgeReset = CKModifyBadgeOperation(badgeValue: 0)
badgeReset.modifyBadgeCompletionBlock = { (error) -> Void in
if error != nil {
print("Error resetting badge: \(error!)")
}else {
DispatchQueue.main.async {
UIApplication.shared.applicationIconBadgeNumber = 0
}
}
}
CKContainer(identifier: "ICloud.AppName").add(badgeReset)
}