ios - 注册远程推送通知失败

标签 ios iphone ios8 apple-push-notifications

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

2015-04-29 00:23:14.688 pushNotificationTest[192:6284] Did Fail to Register for Remote Notifications 2015-04-29 00:23:14.698 pushNotificationTest[192:6284] Error Domain=NSCocoaErrorDomain Code=3000 "no valid 'aps-environment' entitlement string found for application" UserInfo=0x15e89820 {NSLocalizedDescription=no valid 'aps-environment' entitlement string found for application}, no valid 'aps-environment' entitlement string found for application Message from debugger: failed to send the k packet

我使用这个链接来实现它

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];

最佳答案

确保在Build Settings中,用于调试的Code Signing Identity设置为正确的Provisioning Profile

您在其中启用了推送通知。

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

只需转至 Xcode > 首选项 > 帐户 > 选择您的帐户 > 选择您的团队 > 查看详细信息

点击左下角的刷新按钮。 (同时检查build设置中的代码签名)

要创建证书和配置文件,请遵循这个很棒的 Tutorial

关于ios - 注册远程推送通知失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29936975/

相关文章:

ios - kUTTypeURL undefined — 在 Swift 中使用未解析的标识符 'kUTTypeURL'

javascript - iOS矩阵和向量运算

ios - API 网关 : Empty request body?

iphone - 如何使用 MFMailComposerViewController 将 UIImage 添加到电子邮件中?

iphone - PhoneGap截图插件: get image file path and/or Uri

iphone - 如何在文档中下载和保存 xml,然后如何从文档中解析 xml 文件?

ios - showViewController :sender: 的编程对面是什么

iphone - 尝试在 iPhone 5 上运行 iOS 8 应用程序时出现 dyld 错误

ios - 为什么我的 Apple Watch 模拟器是黑色的?

iphone - iTunes Connect 应用程序图标自动更改