nor*_*000 8 deprecated apple-push-notifications ios
我想快速转换出已弃用的推送通知常量,但顺利.我知道实现远程和本地通知的方法也发生了变化,但这超出了本问题的范围.
以下是应考虑的一些因素/约束:
谢谢您的帮助!
She*_*mus 11
幸运的是,这是相当直接的.您需要做的就是使用编译器指令,最好是在推送通知中心的头文件中.在条件指令中,您可以使用定义将自己的常量集映射到新集或不建议集,具体取决于xCode支持的最新iOS版本.
#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
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4763 次 |
| 最近记录: |