RPM*_*RPM 21 notifications local uilocalnotification swift
我在我的应用程序中使用UILocalNotification来安排通知.通知工作正常,并在我需要时显示.我没有这个问题.我没有做任何远程/推送通知.
令我疑惑的是,我从未在几个应用程序中看到过您通常看到的推送通知的着名权限对话框.我甚至重置了我的设备并运行了我的应用程序 这仍然没有导致权限对话框出现.
如果您的应用仅使用本地通知,或者我没有实现某些实际导致应用请求此权限的方法,是否会显示此权限对话框?
我知道我可以在应用程序启动后实现我自己的对话框,要求用户提供此权限,但我希望Apple能够解决这个问题,特别是因为它在设置应用程序中对待远程和本地通知.
注意:这包括推送通知/远程通知
当在运行时使用registerUserNotificationSettings:API时,在iOS7或iOS8测试中使用Xcode6时.
if ([application respondsToSelector:@selector(registerUserNotificationSettings:)]) {
UIUserNotificationSettings* notificationSettings = [UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeAlert | UIUserNotificationTypeBadge | UIUserNotificationTypeSound categories:nil];
[[UIApplication sharedApplication] registerUserNotificationSettings:notificationSettings];
[[UIApplication sharedApplication] registerForRemoteNotifications];
} else {
[[UIApplication sharedApplication] registerForRemoteNotificationTypes: (UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];
}
Run Code Online (Sandbox Code Playgroud)
感谢http://corinnekrych.blogspot.ae/2014/07/how-to-support-push-notification-for.html
| 归档时间: |
|
| 查看次数: |
11666 次 |
| 最近记录: |