registerForRemoteNotificationTypes: is not supported in iOS 8.0 and later

前端 未结 15 1726
时光说笑
时光说笑 2020-11-29 15:09

When trying to register for push notifications under iOS 8.x:

application.registerForRemoteNotificationTypes(UIRemoteNotificationType.Alert | UIRemoteNotific         


        
15条回答
  •  -上瘾入骨i
    2020-11-29 15:19

    If all you need is the ios 8 code, this should do it.

     - (BOOL)application:(UIApplication *)application       didFinishLaunchingWithOptions:(NSDictionary*)launchOptions
    {
           [application registerUserNotificationSettings: [UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeSound  | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge)  categories:nil]];
    
           [application registerForRemoteNotifications];
    }
    
     return YES;
    }
    

提交回复
热议问题