首页 > iOS 消息推送开发 registerUserNotificationSettings 如何处理

iOS 消息推送开发 registerUserNotificationSettings 如何处理

我再开发app 使用到了xcode6,然后调用指南中的 - (BOOL)application:

(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    ...
    // Register for push notifications
    [application registerForRemoteNotificationTypes:
                                UIRemoteNotificationTypeBadge |
                                UIRemoteNotificationTypeAlert |
                                UIRemoteNotificationTypeSound];
    ...
}

编译时出错,提示ios8 需要registerUserNotificationSettings 该如何处理?


if ([application respondForSelector:@selector(registerUserNotificationSettings:)])
    [application registerUserNotificationSettings:...];
else
   [application registerForRemoteNotificationTypes:
                                UIRemoteNotificationTypeBadge |
                                UIRemoteNotificationTypeAlert |
                                UIRemoteNotificationTypeSound];
【热门文章】
【热门文章】