无法注册远程推送通知

时间:2015-04-29 07:25:45

标签: ios iphone ios8 apple-push-notifications

我在使用iOS 8的iPhone 5上设置推送通知时遇到错误:

  

2015-04-29 00:23:14.688 pushNotificationTest [192:6284]失败了   注册远程通知2015-04-29 00:23:14.698   pushNotificationTest [192:6284]错误域= NSCocoaErrorDomain   Code = 3000“找不到有效'aps-environment'权利字符串   应用程序“UserInfo = 0x15e89820 {NSLocalizedDescription =无效   为应用程序找到'aps-environment'权利字符串},无效   为应用程序消息找到'aps-environment'权利字符串   来自调试器:无法发送k数据包

我使用此链接实现它

http://code.tutsplus.com/tutorials/setting-up-push-notifications-on-ios--cms-21925

我已经在这个链接上试过了不同的人提供的这些工作:

Getting an error from push notification

我用来注册的代码

    UIUserNotificationSettings *settings=[UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeAlert | UIUserNotificationTypeBadge | UIUserNotificationTypeSound categories:nil];

    [[UIApplication sharedApplication] registerUserNotificationSettings:settings];
    [[UIApplication sharedApplication] registerForRemoteNotifications];

4 个答案:

答案 0 :(得分:2)

确保在构建设置中,将代码签名标识设置为正确的配置文件

您启用了推送通知。

您不必删除或重新创建任何内容。您只需要让Xcode更新您的活动证书(包括新的推送通知证书)。

只需转到Xcode>偏好>帐户>选择你的帐户>选择你的团队>查看详情

单击左下角的刷新按钮。 (还要检查构建设置中的代码签名)

要创建证书和配置文件,请按照这个真棒Tutorial

进行操作

答案 1 :(得分:2)

在我的情况下,它是“推送通知”选项,该选项未在我的目标的“功能”选项卡中激活。

答案 2 :(得分:0)

您是否为您的App ID启用并配置了推送通知?如果您在创建移动设备后启用它们,请确保重新生成并再次下载mobileprovision。

This应该提供帮助

答案 3 :(得分:0)

我已经解决了它只是命名捆绑包和配置文件之间的冲突我在创建新项目后使名称相同