I would like to transition away from the deprecated Push Notification constants quickly, but smoothly. I understand that the approach in implementing remote and local notifications have also changed, but that is outside the scope of this question.
Here are some factors/constraints that should be considered:
Thank you for your help!
Fortunately this is fairly straight forward. All you need to do is use a compiler directive, preferably in a header file central to your Push Notifications. In the conditional directive, you can map your own set of constants, using defines, to either the new set, or the deprecated set, depending on the latest iOS version that your xCode supports.
#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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With