【问题标题】:enabledRemoteNotificationTypes return invalid valueenabledRemoteNotificationTypes 返回无效值
【发布时间】:2015-04-13 13:24:41
【问题描述】:

您好,我使用的是enabledRemoteNotificationTypes,因为我只针对 iOS 7。

但我观察到,如果我将通知设置为none 并删除应用程序然后重新安装,我发现即使在通知设置中我的选项也被选中,enabledRemoteNotificationTypes 方法返回值3,这有点奇怪。

这是我尝试过的:

UIRemoteNotificationType notificationType = [[UIApplication sharedApplication] enabledRemoteNotificationTypes];
// will return YES if "Alert Style" is set to "Banners" or "Alerts"
if (notificationType & UIRemoteNotificationTypeAlert) {
    returnVal = YES;
} else {
    returnVal = NO;
}

【问题讨论】:

    标签: ios objective-c ios7 nsnotificationcenter


    【解决方案1】:

    我相信 iOS 会以一种相当烦人的方式缓存这些设置。在模拟器上真正重置它的唯一方法是重置它的内容和设置,这样你就可以得到一个干净的状态。

    在物理设备上,您必须在 ADC 网站上将时间调整为 outlined

    1. 从设备中删除您的应用程序。
    2. 完全关闭设备并 重新打开它。
    3. 进入设置 > 常规 > 日期和时间并设置 提前一天或更长时间约会。
    4. 再次完全关闭设备,然后 重新打开它。

    【讨论】:

    • 嘿贾斯汀感谢您的回答,但我有不同的情况。我需要以编程方式重置“缓存”设置。无论如何,再次感谢:)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-12-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多