通知在iOS9中出现两次

时间:2016-06-20 09:06:35

标签: objective-c notifications ios9

我在appDelegate的BackToVarbinary 0x0101010101010101010101 0x110011001100110011001100 0x111000111000111000111000 方法中有以下代码。

application:didFinishLaunchingWithOptions:

我做错了吗?

1 个答案:

答案 0 :(得分:0)

您好,请在application:didFinishLaunchingWithOptions:

中试试
if ([application respondsToSelector:@selector(isRegisteredForRemoteNotifications)])
{
    [application registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge) categories:nil]];

    [application registerForRemoteNotifications];
}
else
{
    [application registerForRemoteNotificationTypes:
     (UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeSound)];
}