本文介绍了使用arc不允许'unsigned long'UIUserNotificationSettings *'的隐式转换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

iOS 8中的推送通知无效。

Push notification in iOS 8 Doesn't work.

错误显示:

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测试版。

I'm using ios 8.0 and xcode 6 beta.

推荐答案

我来自官方的

还可以阅读

AND

..

/// 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.

这篇关于使用arc不允许'unsigned long'UIUserNotificationSettings *'的隐式转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-18 13:06