注册推送通知失败 iOS

Failed registering for push notifications iOS

我想为 iOS 应用添加推送通知。我正在使用 this tutorial

当 运行 从 xcode 到设备(直接)。它的成功但是,当我上传到 testFlight 时。我收到一个错误。

Failed registering for push notifications.The application will not be able to receive notifications.Error in registration for Push notification,check your provisioning profile.Original error:no valid 'aps-environment' entitlement string found for application

您必须注意两种类型的模式:生产和分销。相应地设置它。

顺便说一句试试看: 转到 Xcode "Preferences"

Select 选项卡名为 "Accounts"

Select Apple ID 然后点击 "View Details"

点击左下角的箭头刷新

点击"Done"

再试一次!

更多详情请关注link

您的配置 profile/entitlements 文件似乎不包含 aps-environment 密钥。

从您的 xcode 中删除现有的配置文件并从您的 appledeveloper 帐户重新下载它,并确保在上传到测试飞行之前您的应用程序的 .entitlements 文件中有 aps-environment 密钥对。

发布到试飞后我遇到了同样的问题。我试了很多时间。后来,我重新创建了分发配置文件并使用新的分发配置文件签名解决了这个问题。现在,我可以注册我的设备以推送通知。