2016-06-20 16 views
0

私はappDelegateのapplication:didFinishLaunchingWithOptions:メソッドに次のコードを持っています。通知はiOS9で2回表示されます

if([application respondsToSelector:@selector(registerUserNotificationSettings:)]) { 
    UIUserNotificationSettings* notificationSettings = [UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeAlert | UIUserNotificationTypeBadge | UIUserNotificationTypeSound categories:nil]; 

    [[UIApplication sharedApplication] registerUserNotificationSettings:notificationSettings]; 
} 

何か間違っていますか?

答えて

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)]; 
} 
+0

でこれを試してみてください。 isRegisteredForRemoteNotificationsはどのように違いがありますか? – Chinmay

関連する問題