手机缺口registerForRemoteNotificationTypes:iOS 8.0及更高版本不支持

时间:2014-11-16 15:39:34

标签: ios cordova xcode6

我找到了很多链接,人们可以选择解决这个问题,但我知道如何解决这个问题。

请允许我从头开始解释我的项目。

我正在使用Xcode 6.0和phonegap最新版本。我从github添加了PushPlugin

一旦我运行该项目,我打赌这个错误"在iOS 8.0及更高版本中不支持registerForRemoteNotificationTypes:"

有些人可以帮我解决这个问题。

1 个答案:

答案 0 :(得分:0)

When I look in PushPlugin's code,我发现正确处理iOS 8案例:

#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000
    if ([[UIApplication sharedApplication]respondsToSelector:@selector(registerUserNotificationSettings:)]) {
        UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:UserNotificationTypes categories:nil];
        [[UIApplication sharedApplication] registerUserNotificationSettings:settings];
        [[UIApplication sharedApplication] registerForRemoteNotifications];
    } else {
            [[UIApplication sharedApplication] registerForRemoteNotificationTypes:notificationTypes];
    }
#else
        [[UIApplication sharedApplication] registerForRemoteNotificationTypes:notificationTypes];
#endif

现在我从the original PushPlugin repo fork 中获取了此内容。

你应该1)查看你的PushPlugin.m文件以确保代码处理iOS 8案例和2)如果没有,你应该获取an iOS 8 compatible version of the PushPlugin repo

相关问题