iOS 8中的推送通知不起作用.
implicit conversion of 'unsigned long 'UIUserNotificationSettings *' is disallowed with arc
码:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [application registerUserNotificationSettings:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge)]; return YES; }
我正在使用ios 8.0和xcode 6 beta.
解决方法
我从
below from official documentation of iOS 8.开始
- Apps that use local or push notifications must explicitly register the types of alerts that they display to users by using a UIUserNotificationSettings object. This registration process is separate from the process for registering remote notifications,and users must grant permission to deliver notifications through the requested options.
- Local and push notifications can include custom actions as part of an alert. Custom actions appear as buttons in the alert. When tapped,your app is notified and asked to perform the corresponding action. Local notifications can also be triggered by interactions with Core Location regions.
还读了
和
所以答案应该是……
/// First register notification setting with settings type like [[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge) categories:nil]]; [[UIApplication sharedApplication] registerForRemoteNotifications]; // you can also set here for local notification.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。