简体   繁体   English

无法注册推送通知iOS

[英]Failed registering for push notifications iOS

I want add push notification for iOS app. 我想为iOS应用添加推送通知。 I'm using this tutorial 我正在使用本教程

When run from xcode to Device (direct). 从xcode运行到设备(直接)时。 Its success But, when I upload to testFlight. 它的成功但是,当我上传到testFlight时。 I get an error. 我得到一个错误。

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 推送通知注册失败。应用程序将无法接收通知。推送通知注册错误,请检查您的配置文件。原始错误:找不到适用于应用程序的有效“ aps-environment”授权字符串

There are two types of modes that you have to taken care of: Production and Distribution. 您必须注意两种类型的模式:生产和分发。 Set it accordingly. 进行相应设置。

BTW try it: Go to Xcode "Preferences" 顺便说一句尝试:转到Xcode“首选项”

Select tab named "Accounts" 选择名为“帐户”的标签

Select Apple ID and click "View Details" 选择Apple ID,然后单击“查看详细信息”

Click on the arrow on the bottom left corner to refresh 单击左下角的箭头以刷新

Click "Done" 点击“完成”

And try again ! 然后再试一次 !

For more details follow link . 有关更多详细信息,请单击链接

It seems to be your Provisioning profile/entitlements file doesn't contains aps-environment key. 看来您的配置文件/权利文件不包含aps-environment密钥。

Delete the existing provisioning profile from your xcode and re-download it from your appledeveloper account and make sure you have aps-environment key pair in your app's .entitlements file before uploading to test flight. 从xcode中删除现有的配置文件,然后从appledeveloper帐户重新下载它,并确保在上传到测试飞行之前,应用程序的.entitlements文件中具有aps-environment密钥对。

I had a same issue after publishing to test flight. 发布测试飞行后,我遇到了同样的问题。 I tried lot of time. 我花了很多时间。 later, i recreated distribution profile and signing with new distribution profile solve that issue. 后来,我重新创建了分发配置文件,并使用新的分发配置文件签名解决了该问题。 Now, I am able to register my device to push notification. 现在,我可以注册我的设备以推送通知了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM