Unable to register for Push Notifications (Xcode 7, iOS9)

前端 未结 2 1062
误落风尘
误落风尘 2021-01-14 11:53

I\'ve upgraded my devices to iOS 9 and my Xcode environment to 7.0 (7A220). My app registers for notifications via:

[[UIApplication sharedApplication] regis         


        
2条回答
  •  一生所求
    2021-01-14 12:08

    The reason why it wasn't working was because I wasn't calling:

    [[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge) categories:nil]];
    

    Prior to the call:

    [[UIApplication sharedApplication] registerForRemoteNotifications];
    

提交回复
热议问题