我有一个应用程序,之前已经通过以下 3 个选项请求用户对通知的权限:
- UNAuthorizationOptionBadge
- UNAuthorizationOptionSound
- UNAuthorizationOptionAlert
现在我想为应用程序推送一个更新,该应用程序请求另一个选项以获得相同的权限,即UNAuthorizationOptionCriticalAlert
我正在使用此代码:-
UNAuthorizationOptions options = ( UNAuthorizationOptionBadge | UNAuthorizationOptionSound | UNAuthorizationOptionAlert | UNAuthorizationOptionCriticalAlert);
[[UNUserNotificationCenter currentNotificationCenter] requestAuthorizationWithOptions:options completionHandler:^(BOOL granted, NSError *_Nullable error) {
if (!granted) {
NSLog(@"Something To Print3");
return;
}
}];
但是,操作系统不会要求用户提供新选项,因为它认为之前已经授予了此权限。在上面的例子中授予已经是真的。我尝试删除 3 个旧权限,但得到了相同的结果。
如何让操作系统请求新选项UNAuthorizationOptionCriticalAlert
?