iPhone 应用程序 APNS 无法获取设备令牌,错误:“没有有效的‘aps-environment’”找到应用程序的权利字符串”
生成的 XCode 错误:
"Error Domain=NSCocoaErrorDomain Code=3000 "no valid 'aps-environment' entitlement string found for application" UserInfo=0x1c7a60 {NSLocalizedDescription=no valid 'aps-environment' entitlement string found for application}" error.
我已生成启用 APNS 的应用程序 ID(开发应用程序 ID)。
并使用此应用程序 ID 创建了一个新的配置文件,并将其安装在 XCode 中以供使用。
我认为问题出在“iOS Team Provisioning Profile: *”配置文件上。它的AppID是我几个月前生成的,没有启用APNS,我不再使用它了。
但问题是,我无法编辑/删除它!每次我通过在苹果门户中单击“删除”来“删除”它时,它都会再次出现。
我认为问题来自于此的原因是因为我打开这个配置文件查看文本,我找不到aps-environment,虽然我可以在使用新的支持 APNS 的应用程序 ID 新创建的配置文件中找到此标签。
我还在安装了我的应用程序的 iPhone 中包含了新的配置文件。但我担心这是因为旧的配置文件(即iOS团队配置文件:*)也总是出现在设备中。
或者可能是因为其他原因。希望有人能给我解决问题的想法。
The XCode error generated:
"Error Domain=NSCocoaErrorDomain Code=3000 "no valid 'aps-environment' entitlement string found for application" UserInfo=0x1c7a60 {NSLocalizedDescription=no valid 'aps-environment' entitlement string found for application}" error.
I have generated App ID with APNS enabled (the Development one).
And have created a new provisioning profile with this App ID, and installed it in XCode for use.
I think the problem is the "iOS Team Provisioning Profile: *" profile. Its AppID is the one which I generated several months ago, with no APNS enabled, and I don't use it anymore.
But the problem is, I can't edit/delete it! Everytime I "deleted" it by clicking delete in the apple portal, it would appear again.
The reason why I think the problem comes from this is because I opened this provisioning profile to see the text, I can't find the aps-environment, while I can find this tag in the provisioning profile that is newly created with the new APNS-enabled App ID.
I have also included the new provisioning profile in my iPhone in which my app is installed. But I feared that it's because of that old provisioning profile(i.e. iOS Team Provisioning Profile: *) always appear in the device, too.
Or it may be because of other reasons. Hope someone can give me ideas to tackle the problem.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Apple 文档解释了如何为启用推送通知的应用程序创建配置文件不能使用“通配符”应用程序 ID。这意味着团队配置文件不能用于对注册推送通知的应用程序进行签名(团队配置配置文件中没有 aps-environment 密钥)。
您无法删除应用程序 ID。请参阅这篇文章。只要存在“通配符”AppID,每当您尝试在 XCode Organizer 中刷新配置文件时,XCode 都会自动为该 ID 创建团队配置文件。因此,一旦创建了 XCode 中的团队配置配置文件,就不可能将其删除。
The Apple documentation that explains creating the provisioning profile for an application that is enabled for push notifications mentions that the "wildcard" application ID can't be used. This means that a Team Provisioning profile can't be used to sign an application that is registering for push notifications (there is no aps-environment key in a Team Provisioning Profile).
You can't remove application id. See this post. And as long as there is a "wildcard" AppID XCode will automatically create a Team Provisioning Profile for that ID any time you try to refresh the provisioning profile in XCode Organizer. So looks like it is not possible to to get rid of the Team Provisioning Profile in XCode once it has been created.
我收到此错误消息一次,发现我没有在我的应用程序中分配新生成的配置文件
。您可以通过转到项目构建设置来执行此操作。搜索代码签名身份,并根据您的情况设置上述开发配置文件,并根据您的需要在调试下启用APNS。 (您可以在 Targets Build Settings 中找到类似的设置)
I got this error message once and figured out I did not assigned the newly generated profile in my app
You do that by going to your Projects Build Settings. Search for Code Signing Identity and in your case set the mentioned development profile with APNS enabled under Debug according to your needs. (You can find similar setting in your Targets Build Settings)