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


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


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

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

ios8 消息推送 xcode6

炮姐D凝视 11 years, 4 months ago

 if ([application respondForSelector:@selector(registerUserNotificationSettings:)])
    [application registerUserNotificationSettings:...];
else
   [application registerForRemoteNotificationTypes:
                                UIRemoteNotificationTypeBadge |
                                UIRemoteNotificationTypeAlert |
                                UIRemoteNotificationTypeSound];

无聊的喝茶 answered 11 years, 3 months ago

Your Answer