@@ -415,56 +415,27 @@ - (BOOL)application:(UIApplication *)p_application didFinishLaunchingWithOptions
415415 NSArray *t_allowed_push_notifications_array;
416416 t_allowed_push_notifications_array = [t_info_dict objectForKey: @" CFSupportedRemoteNotificationTypes" ];
417417
418- if (t_allowed_push_notifications_array != nil )
419- {
420- // MM-2014-09-30: [[ iOS 8 Support ]] Use new iOS 8 registration methods for push notifications.
421- if (![[UIApplication sharedApplication ] respondsToSelector :@selector (registerUserNotificationSettings: )])
422- {
423- UIRemoteNotificationType t_allowed_notifications = UIRemoteNotificationTypeNone;
424- for (NSString *t_push_notification_string in t_allowed_push_notifications_array)
425- {
426- if ([t_push_notification_string isEqualToString: @" CFBadge" ])
427- t_allowed_notifications = (UIRemoteNotificationType) (t_allowed_notifications | UIRemoteNotificationTypeBadge);
428- else if ([t_push_notification_string isEqualToString: @" CFSound" ])
429- t_allowed_notifications = (UIRemoteNotificationType) (t_allowed_notifications | UIRemoteNotificationTypeSound);
430- else if ([t_push_notification_string isEqualToString: @" CFAlert" ])
431- t_allowed_notifications = (UIRemoteNotificationType) (t_allowed_notifications | UIRemoteNotificationTypeAlert);
432- }
433-
434- // IM-2012-02-13 don't try to register if there are no allowed push notification types
435- if (t_allowed_notifications != UIRemoteNotificationTypeNone)
436- {
437- // Inform the device what kind of push notifications we can handle.
438-
439- // MW-2013-07-29: [[ Bug 10979 ]] Dynamically call the 'registerForRemoteNotificationTypes' to
440- // avoid app-store warnings.
441- objc_msgSend ([UIApplication sharedApplication ], sel_getUid (" registerForRemoteNotificationTypes:" ), t_allowed_notifications);
442- }
443- }
444- #ifdef __IPHONE_8_0
445- else
446- {
447- UIUserNotificationType t_allowed_notifications;
448- t_allowed_notifications = UIUserNotificationTypeNone;
449- for (NSString *t_push_notification_string in t_allowed_push_notifications_array)
450- {
451- if ([t_push_notification_string isEqualToString: @" CFBadge" ])
452- t_allowed_notifications = (UIRemoteNotificationType) (t_allowed_notifications | UIUserNotificationTypeBadge);
453- else if ([t_push_notification_string isEqualToString: @" CFSound" ])
454- t_allowed_notifications = (UIRemoteNotificationType) (t_allowed_notifications | UIUserNotificationTypeSound);
455- else if ([t_push_notification_string isEqualToString: @" CFAlert" ])
456- t_allowed_notifications = (UIRemoteNotificationType) (t_allowed_notifications | UIUserNotificationTypeAlert);
457- }
458- if (t_allowed_notifications != UIUserNotificationTypeNone)
459- {
460- m_is_remote_notification = true ;
461- UIUserNotificationSettings *t_push_settings;
462- t_push_settings = [UIUserNotificationSettings settingsForTypes: t_allowed_notifications categories: nil ];
463- [[UIApplication sharedApplication ] registerUserNotificationSettings: t_push_settings];
464- }
465- }
466- #endif
467- }
418+ if (t_allowed_push_notifications_array != nil )
419+ {
420+ UIUserNotificationType t_allowed_notifications;
421+ t_allowed_notifications = UIUserNotificationTypeNone;
422+ for (NSString *t_push_notification_string in t_allowed_push_notifications_array)
423+ {
424+ if ([t_push_notification_string isEqualToString: @" CFBadge" ])
425+ t_allowed_notifications = (UIRemoteNotificationType) (t_allowed_notifications | UIUserNotificationTypeBadge);
426+ else if ([t_push_notification_string isEqualToString: @" CFSound" ])
427+ t_allowed_notifications = (UIRemoteNotificationType) (t_allowed_notifications | UIUserNotificationTypeSound);
428+ else if ([t_push_notification_string isEqualToString: @" CFAlert" ])
429+ t_allowed_notifications = (UIRemoteNotificationType) (t_allowed_notifications | UIUserNotificationTypeAlert);
430+ }
431+ if (t_allowed_notifications != UIUserNotificationTypeNone)
432+ {
433+ m_is_remote_notification = true ;
434+ UIUserNotificationSettings *t_push_settings;
435+ t_push_settings = [UIUserNotificationSettings settingsForTypes: t_allowed_notifications categories: nil ];
436+ [[UIApplication sharedApplication ] registerUserNotificationSettings: t_push_settings];
437+ }
438+ }
468439
469440 // MM-2014-09-26: [[ iOS 8 Support ]] Move the registration for orientation updates to here from init. Was causing issues with iOS 8.
470441 // Tell the device we want orientation notifications.
0 commit comments