gpt4 book ai didi

ios - UIRemoteNotificationTypeAlert 已弃用 - 我如何在大型团队中过渡到 UIUserNotificationTypeAlert?

转载 作者:可可西里 更新时间:2023-11-01 03:08:10 24 4
gpt4 key购买 nike

我想快速、平稳地从已弃用的推送通知常量过渡。我知道实现远程和本地通知的方法也发生了变化,但这超出了这个问题的范围。

以下是应考虑的一些因素/限制因素:

  1. 我有一个相当庞大的 iOS 开发团队。
  2. 一些开发人员仍在使用 xCode 5,它不使用 iOS 8 API 进行编译。
  3. 一些开发人员已经在使用 xCode 6.2 Beta 3,它使用了 xCode 6.1.1 中不可用的额外 WatchKit 目标。
  4. 绝大多数开发人员都在使用 xCode 6.1.1。

感谢您的帮助!

最佳答案

幸运的是,这是相当简单的。您需要做的就是使用编译器指令,最好是在推送通知中心的头文件中。在条件指令中,您可以使用定义将您自己的常量集映射到新集或已弃用的集,具体取决于您的 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

关于ios - UIRemoteNotificationTypeAlert 已弃用 - 我如何在大型团队中过渡到 UIUserNotificationTypeAlert?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27936023/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com