UIRemoteNotificationTypeAlert is deprecated - how do I upgrade to UIUserNotificationTypeAlert with a large team?

I would like to quickly switch from deprecated Push Notification constants, but smoothly. I understand that the approach to remote and local notifications has also changed, but this is beyond the scope of this question.

Here are some factors / limitations to consider:

  • I have a fairly large group of iOS developers.
  • Some developers still use xCode 5, which does not compile with the iOS 8 API.
  • Some developers are already using xCode 6.2 Beta 3, which uses the optional WatchKit target, which is not available in xCode 6.1.1.
  • The vast majority of developers use xCode 6.1.1.

Thank you for your help!

+7
ios deprecated apple-push-notifications
source share
1 answer

Fortunately, this is pretty straight forward. All you have to do is use the compiler directive, preferably in the header file, central to your push notifications. In the conditional directive, you can map your own set of constants using definitions, either to a new set or an outdated set, depending on the latest version of iOS supported by your xCode.

#ifdef __IPHONE_8_0 #define RemoteNotificationTypeAlert UIUserNotificationTypeAlert #define RemoteNotificationTypeBadge UIUserNotificationTypeBadge #define RemoteNotificationTypeSound UIUserNotificationTypeSound #define RemoteNotificationTypeNone UIUserNotificationTypeNone #else #define RemoteNotificationTypeAlert UIRemoteNotificationTypeAlert #define RemoteNotificationTypeBadge UIRemoteNotificationTypeBadge #define RemoteNotificationTypeSound UIRemoteNotificationTypeSound #define RemoteNotificationTypeNone UIRemoteNotificationTypeNone #endif 
+10
source share

All Articles