ios Xcode 8 APS 环境权利不会设置为生产

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/39625258/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 10:18:26  来源:igfitidea点击:

Xcode 8 APS Environment Entitlement won't set to production

iosxcodeapple-push-notifications

提问by user2337981

I have push notifications working on my app.
I went to go submit a new app update and I ran into an error with APS environment not being set.
I hit fix issue and it created the entitlement file with APS environment set to development.

To submit the app I obviously want this set to production. I change the value to production and proceed to archive the app for submission.
It throws an error in the capabilities section for push notifications with the last past "Add the Push Notifications entitlement to your entitlements file" being red.

So when I hit fix issue, it then changes the value of APS environment to development.
I came across a suggestion to inspect the provisioning profile and look for the APS environment property.
I went through the process of archiving and selected "Upload to App Store".

When I finally reached the summary, I clicked on the provisioning profile attached to the binary and entitlements.
I open the provisioning profile in a text editor and looked for the APS environment property.
I did find the property and it is set to production in the provision profile.
I decided to try another suggestion, which was to recreate the distribution provisioning profile.
I did make a new one and that solution doesn't work either.

From what I understand, the APS environment property is based on the value in your provisioning profile.

我的应用程序有推送通知。
我去提交一个新的应用程序更新,但遇到了未设置 APS 环境的错误。
我遇到了修复问题,它创建了 APS 环境设置为开发的权利文件。

要提交应用程序,我显然希望将此设置投入生产。我将值更改为 production 并继续存档应用程序以进行提交。
它在推送通知的功能部分引发错误,最后一个“将推送通知权利添加到您的权利文件”为红色。

因此,当我遇到修复问题时,它会将 APS 环境的价值更改为开发。
我遇到了检查配置文件并查找 APS 环境属性的建议。
我完成了存档过程并选择了“上传到 App Store”。

当我最终看到摘要时,我单击了附加到二进制文件和权利的配置文件。
我在文本编辑器中打开配置文件并查找 APS 环境属性。
我确实找到了该属性,并且在配置文件中将其设置为生产。
我决定尝试另一个建议,即重新创建分发配置文件。
我确实做了一个新的,但该解决方案也不起作用。

据我了解,APS 环境属性基于您的配置文件中的值。

Any help would be appreciated. Thanks.

任何帮助,将不胜感激。谢谢。

回答by yuchen

Turn off the "push notifications" in Capabilities then re-build.

关闭功能中的“推送通知”,然后重新构建。

Update

更新

After hours of debugging, no matter how you configure Xcode8 or build with whatever scheme(debug or production), you will always get a deviceToken for development environment from APNS. I tried to remove my app on my test device which build directly from Xcode8.1 with production scheme. Then I installed my app from AppStore, which was archived from Xcode8.1 with same configuration two weeks ago, the AppStore version's notification service works fine, which proves that Xcode did set the right entitlement value for production environment. So, the solution is: leave the entitlements file alone, and keep "Push Notifications" switch on in Capabilities, do any fixes Xcode asked for. Hope this would help you.

经过数小时的调试,无论您如何配置 Xcode8 或使用任何方案(调试或生产)构建,您总会从 APNS 获得用于开发环境的 deviceToken。我试图在我的测试设备上删除我的应用程序,该应用程序直接从 Xcode8.1 构建并使用生产方案。然后我从 AppStore 安装了我的应用程序,该应用程序是两周前从 Xcode8.1 以相同配置存档的,AppStore 版本的通知服务工作正常,这证明 Xcode 确实为生产环境设置了正确的授权值。因此,解决方案是:单独保留权利文件,并在功能中保持“推送通知”打开,执行 Xcode 要求的任何修复。希望这会帮助你。

回答by Mayank Kumar

For me XCode 8 'Automatically manage signing' feature do it automatically & correctly when archiving according to provisioning profile we select for deployment method.

对我来说,XCode 8 的“自动管理签名”功能在根据我们为部署方法选择的配置文件归档时自动且正确地执行此操作。

回答by Mr.Fingers

Try to re-enable "Push Notifications" capabilities in , it worked for me, if this don't help, try to delete file with entitlements in your project, and again re-enable "Push Notifications" capabilities in your project settings

尝试在 中重新启用“推送通知”功能,它对我有用,如果这没有帮助,请尝试删除项目中具有权利的文件,然后再次在项目设置中重新启用“推送通知”功能

回答by PradeepKN

After trying all the answers in stack over flow found out the problem is in entitlement.plistfile can be debuggedflag was set to TRUE.

在尝试堆栈溢出流中的所有答案后,发现问题出在entitlement.plist文件can be debugged标志被设置为TRUE.

  1. Try to disableand re-enablepush notifications in Xcode target capabilities.
  2. Can be debuggedflag should be set to NOto submit it to AppStore.
  1. 尝试disablere-enable在Xcode目标的能力推送通知。
  2. Can be debugged标志应设置为NO将其提交到 AppStore。

Build and archive. You should be able to see environment set to production.

构建和归档。您应该能够看到环境设置为生产。