RegisterUserNotificationSettings is not working in ios 6.1

前端 未结 2 2047
旧巷少年郎
旧巷少年郎 2021-01-04 22:27

I am using the Parse SDK for push notification in my project. I have added the code in didFinishLaunchingWithOptions: as given on the parse.com

         


        
2条回答
  •  猫巷女王i
    2021-01-04 22:36

    For iOS8:

    if ([application respondsToSelector:@selector(registerUserNotificationSettings:)]) {
        UIUserNotificationSettings* notificationSettings = [UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeAlert | UIUserNotificationTypeBadge | UIUserNotificationTypeSound categories:nil];
        [[UIApplication sharedApplication] registerUserNotificationSettings:notificationSettings];
        [[UIApplication sharedApplication] registerForRemoteNotifications];
    } else {
        [[UIApplication sharedApplication] registerForRemoteNotificationTypes: (UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];
    }
    

提交回复
热议问题