RegisterUserNotificationSettings在ios 6.1中不起作用

我在我的项目中使用Parse SDK进行推送通知。 我已经添加了didFinishLaunchingWithOptions:的代码didFinishLaunchingWithOptions:在parse.com上给出

 UIUserNotificationType userNotificationTypes = (UIUserNotificationTypeAlert | UIUserNotificationTypeBadge | UIUserNotificationTypeSound); UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:userNotificationTypes categories:nil]; [application registerUserNotificationSettings:settings]; [application registerForRemoteNotifications]; 

它的工作正常,如果设备或模拟器版本是iOS 8,但它不在iOS 6.1中工作,并且出现消息

[UIApplication registerUserNotificationSettings:]: unrecognized selector sent to instance 0x208406c0

任何人都可以告诉我如何解决它?

在didFinishLaunchingWithOptions方法中使用此代码它是在iOS 6和7中工作

 [application registerForRemoteNotificationTypes: (UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeSound)]; 

如果你想在所有情况下工作在6,7,8然后使用这个代码内didFinishLaunchingWithOptions

  if ([application respondsToSelector:@selector(isRegisteredForRemoteNotifications)]) { // iOS 8 Notifications [application registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge) categories:nil]]; [application registerForRemoteNotifications]; } else { // iOS < 8 Notifications [application registerForRemoteNotificationTypes: (UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeSound)]; } 

对于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)]; }