ios 缺少推送通知权利

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14807129/
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-30 22:15:08  来源:igfitidea点击:

Missing Push Notification Entitlement

iosprofileapple-push-notifications

提问by mirageservo

I have an app for submission when it got rejected and I got the message

我有一个应用程序被拒绝时要提交,我收到了消息

Missing Push Notification Entitlement - Your app appears to register with the Apple Push Notification service, but the app signature's entitlements do not include the "aps-environment" entitlement. If your app uses the Apple Push Notification service, make sure your App ID is enabled for Push Notification in the Provisioning Portal, and resubmit after signing your app with a Distribution provisioning profile that includes the "aps-environment" entitlement.

缺少推送通知权利 - 您的应用似乎注册了 Apple 推送通知服务,但应用签名的权利不包括“aps-environment”权利。如果您的应用程序使用 Apple 推送通知服务,请确保您的 App ID 已在配置门户中启用推送通知,并在使用包含“aps-environment”权利的分发配置文件对您的应用程序进行签名后重新提交。

I checked my ad-hoc provisiong and there I found aps-environment and production however, when I open up my distribution provisioning, I don't find such.

我检查了我的临时配置,在那里我找到了 aps-environment 和 production,但是当我打开我的分发配置时,我没有找到这样的。

Is this the cause of this error message and apple rejection, how can I fix it?

这是此错误消息和苹果拒绝的原因,我该如何解决?

采纳答案by tom

Yes, that's the cause of the App Store rejection. If your ad-hoc provisioning profile has the aps-environment key, it means your app is configured correctly in the Apple Provisioning Portal. All you need to do is delete the App Store distribution profile on your local machine, then re-download and install the distribution profile from the Provisioning Portal. This new one should contain the aps-environment key.

是的,这就是 App Store 拒绝的原因。如果您的临时配置文件具有 aps-environment 密钥,则意味着您的应用程序已在 Apple Provisioning Portal 中正确配置。您需要做的就是删除本地计算机上的 App Store 分发配置文件,然后从 Provisioning Portal 重新下载并安装分发配置文件。这个新的应该包含 aps-environment 密钥。

回答by Mina Fawzy

First App ID

第一个应用程序 ID

make sure your ID push notification enable in production side

确保您的 ID 推送通知在生产端启用

as appear in picture

如图所示

enter image description here

在此处输入图片说明

Second Certificate

第二证书

from production section create two certificate with your id (push notification enabled)

从生产部分使用您的 id 创建两个证书(启用推送通知)

App Store and Ad Hoccertificate

App Store 和 Ad Hoc证书

Apple Push Notification service SSL (Sandbox)certificate

Apple 推送通知服务 SSL(沙盒)证书

enter image description here

在此处输入图片说明

Third Provisioning Profiles

第三配置文件

From Distribution section create App Storeprofile with your id

从分发部分使用您的 ID创建App Store配置文件

Finally

最后

while you upload your bin , you must check what provisioning profile used and have many entitlements

当你上传你的 bin 时,你必须检查使用了什么配置文件并且有很多权利

enter image description here

在此处输入图片说明

this all cases cause this problem hope this be helpful with you

这所有情况都会导致此问题希望这对您有所帮助

回答by Vaiden

In XCode 8 you need to enable push in the Capabilities tab on your target, on top of enabling everything on the provisions and certificates: Xcode 8 "the aps-environment entitlement is missing from the app's signature" on submit

在 XCode 8 中,除了启用规定和证书上的所有内容之外,您还需要在目标上的“功能”选项卡中启用推送: 提交时,Xcode 8“应用程序签名中缺少 aps-environment 权利”

My blog post about this here.

我的博客文章在这里

回答by Simon Woodside

I got this message for a different reason -- I submitted an app via Xcode without first creating an App Store Distribution Profile specifically for the app. I believe Xcode automatically uses a wildcard App Store profile if you have one installed. But an app uses Push Notifications requires its own profile.

我收到此消息的原因不同——我通过 Xcode 提交了一个应用程序,而没有先为该应用程序专门创建一个 App Store 分发配置文件。我相信 Xcode 会自动使用通配符 App Store 配置文件(如果您安装了该配置文件)。但是使用推送通知的应用程序需要自己的配置文件。

The fix is to create a new App Store Distribution profile for the app. Then you download it, drag it onto Xcode, and modify your project Build Settings > Code Signing > Release to use the new profile.

解决方法是为应用程序创建一个新的 App Store Distribution 配置文件。然后您下载它,将其拖到 Xcode 上,然后修改您的项目 Build Settings > Code Signing > Release 以使用新的配置文件。

回答by Ian

Following on from the answer given by @Vaiden, in Xcode 8 you can resolve this issue by selecting the target and clicking the "Fix issue". Of course, you'll still need to set up push notifications in the Apple Developer portal(you can simplify the process a little by using the new "Automatically manage signing" option, which saves you the hassle of downloading the provisioning profiles).

继@Vaiden 给出的答案之后,在 Xcode 8 中,您可以通过选择目标并单击“修复问题”来解决此问题。当然,您仍然需要在Apple Developer 门户中设置推送通知(您可以使用新的“自动管理签名”选项简化流程,从而免去下载配置文件的麻烦)。

Fix me option

修复我选项

回答by Adam Eisfeld

For those running into this issue who actually are using Push Notifications in their apps:

对于那些在他们的应用中实际使用推送通知的人来说:

Our push certs were recently about to expire, so we created new dev / prod push certs in the standard way outlined by Apple (I won't go into detail around this here, there is plenty of info on it all over the web when updating your push certs for another year of use).

我们的推送证书最近即将到期,因此我们以 Apple 概述的标准方式创建了新的开发/生产推送证书(我不会在这里详细介绍,更新时网络上有很多关于它的信息您的推送证书再使用一年)。

After doing so however, the issue in this question popped up. No matter what we did, we received this email from Apple after submitting our app. When we checked the settings of our Distribution Provisioning Profile in the Apple Member Center, everything looked fine (Push was enabled for our App ID for both prod / dev, and our distribution provisioning profile was still connected to this App ID, we literally just created new push certs for another year as is the standard practice).

然而,这样做之后,这个问题中的问题出现了。无论我们做了什么,我们都会在提交我们的应用程序后收到来自 Apple 的这封电子邮件。当我们在 Apple Member Center 检查我们的 Distribution Provisioning Profile 的设置时,一切看起来都很好(我们的 App ID 为 prod / dev 启用了推送,我们的分发配置文件仍然连接到这个 App ID,我们实际上只是创建了新的推送证书又是标准做法)。

Finally, this is what ended up solving it for me:

最后,这就是最终为我解决的问题:

  1. Create a new Distribution Provisioning Profile pointing to your App ID (leave your current one in tact)
  2. In Xcode, refresh your provisioning profiles via Settings > Accounts > Select your account > Details > Click the refresh icon
  3. Manually create an entitlements plist file for your app:
    • File menu > New File...
    • Select iOS > Resource > Property List
    • Name the new file "foo.entitlements" (typically, "foo" is the target name)
    • Click the (+) next to "Entitlements File" to add a top-level item (the property list editor will use the correct schema due to the file extension)
  4. Ensure this entitlements file is being used in your target's Build Settings (Target > Build Settings > Search for "Entitlements", in the CODE_SIGN_ENTITLEMENTS set the path to your Entitlements file you just made)
  5. Make sure the provisioning profile / code signing identity in your Target is set correctly to your appropriate distribution provisioning profile / signing identity (this should be obvious)
  6. I'm not 100% sure if this affected it (it shouldn't since Target settings override project settings, but I did this anyways), make sure your Project's provisioning profile / signing identity match your Target's
  7. In the entitlements file you made, right click in the empty file and select "Show Raw Keys/Values"
  8. Add a new entry to the entitlements file called "aps-environment" and set it's value to "production"
  9. One key note, if you were previously using the keychain-access-groups entitlement, you'll want to add that key here as well because for some reason it got cleared for me when doing this manually. Make sure the value is the same as the value used in previous builds (you can find the value by finding a previous build in Organizer, attempting to submit to the app store, select your team, then before submitting the app tap the arrow beside the "(X) Entitlements" string to expand the entitlements and see the value of the keychain-access-group entitlement.
  10. Archive your app and attempt to submit it to the point of getting to the final "Submit" button. You should see this app was now built with the new provisioning profile you created in member center. Cancel out of this now.
  11. Go back to the Apple member center and delete the new provisioning profile you created in step 1.
  12. Back in Xcode, refresh your provisioning profiles list once again by repeating step 2.
  13. Now archive your app again, and you should see that the app was built with the old Distribution provisioning profile you wanted to use, and correctly has the aps-environment entitlement. Submit and you're done.
  1. 创建一个指向您的 App ID 的新分发配置文件(保留当前的一个)
  2. 在 Xcode 中,通过设置 > 帐户 > 选择您的帐户 > 详细信息 > 单击刷新图标刷新您的配置文件
  3. 为您的应用手动创建权利 plist 文件:
    • 文件菜单 > 新建文件...
    • 选择 iOS > 资源 > 属性列表
    • 将新文件命名为“foo.entitlements”(通常,“foo”是目标名称)
    • 单击“权利文件”旁边的 (+) 以添加顶级项目(由于文件扩展名,属性列表编辑器将使用正确的架构)
  4. 确保在目标的构建设置中使用此权利文件(目标 > 构建设置 > 搜索“权利”,在 CODE_SIGN_ENTITLEMENTS 中设置您刚刚创建的权利文件的路径)
  5. 确保 Target 中的配置文件/代码签名标识已正确设置为适当的分发配置文件/签名标识(这应该很明显)
  6. 我不是 100% 确定这是否会影响它(它不应该因为目标设置覆盖项目设置,但我还是这样做了),请确保您的项目的配置文件/签名身份匹配您的目标
  7. 在您创建的权利文件中,右键单击空文件并选择“显示原始键/值”
  8. 向名为“aps-environment”的权利文件添加一个新条目并将其值设置为“production”
  9. 一个重要说明,如果您以前使用过钥匙串访问组权利,您还需要在此处添加该密钥,因为由于某种原因,我在手动执行此操作时已将其清除。确保该值与之前构建中使用的值相同(您可以通过在 Organizer 中查找之前的构建来找到该值,尝试提交到应用商店,选择您的团队,然后在提交应用之前点击旁边的箭头"(X) Entitlements" 字符串以展开权利并查看钥匙串访问组权利的值。
  10. 归档您的应用程序并尝试将其提交到最后的“提交”按钮。您应该会看到此应用程序现在是使用您在会员中心创建的新配置文件构建的。现在取消这个。
  11. 返回 Apple 会员中心并删除您在步骤 1 中创建的新配置文件。
  12. 返回 Xcode,通过重复步骤 2 再次刷新您的配置文件列表。
  13. 现在再次归档您的应用程序,您应该看到该应用程序是使用您想要使用的旧分发配置文件构建的,并且正确地具有 aps-environment 权利。提交,你就完成了。

I know this isn't as detailed as it should be as it should have screenshots, I will try to update it with screenshots when I can but for the time being I'm in a time crunch right now and wanted to get the jist of what I did out there. There is also a very likely chance that some or most of the steps I've outlined aren't necessary, I'm putting them here because I did them and they may have led to the final solution.

我知道这不像它应该有的截图那么详细,我会尽可能用截图更新它,但目前我正处于时间紧迫的状态,想了解一下我在那里做了什么。我概述的部分或大部分步骤也很有可能不是必需的,我将它们放在这里是因为我做了它们,它们可能导致了最终的解决方案。

回答by Vishal's p

check Your App Id is Push Enabled or not on developer.apple.com in iOS Provisioning Portal If Not then Enabled it,configure Your Push SSL Certificate for your App Id Download it, and Reinstall in Your Keychain Once again then Download Your Distrubution Profile install in your Xcode Liabrary

在 iOS 配置门户中的 developer.apple.com 上检查您的 App Id 是否已启用推送 如果未启用它,请为您的 App Id 配置您的 Push SSL 证书在您的 Xcode 库中

回答by Desert Rose

I was also facing this issue even I was not using push notifications at allin my app.Making new provisioning profilealso did not work for me.What I did was:-

即使我在我的应用程序中根本没有使用推送通知,我也面临这个问题。制作新的配置文件对我也不起作用。我所做的是:-

1.Create fresh new certificate for Ad hoc & App Store only.

1.仅为 Ad hoc 和 App Store 创建全新的证书。

2.Then make distribution profile with this certificate and integrate profile with Xcode.

2.然后使用此证书制作分发配置文件并将配置文件与Xcode集成。

Then newly submitted build with this profile approved without any warning.

然后在没有任何警告的情况下批准了此配置文件的新提交的构建。

回答by Chris

To solve this for an expo 'ejected' app, I went to the capabilities tab, enabled push, then disabled it again. This removed the APNS 'entitlements' setting from the .entitlements file.

为了解决一个 expo 'ejected' 应用程序的问题,我转到了功能选项卡,启用了推送,然后再次禁用了它。这从 .entitlements 文件中删除了 APNS 'entitlements' 设置。

回答by mogile_oli

This was what fixed it for me. (I had already tried toggling the capabilities on/off, recreating the provisioning profile, etc).

这就是为我修复它的原因。(我已经尝试打开/关闭功能,重新创建配置文件等)。

In the Build Settingstab, in Code Signing Entitlements, my .entitlementsfile wasn't link for all sections. Once I added it to the Any SDK section, the error was resolved.

Build Settings选项卡中,在Code Signing Entitlements 中,我的.entitlements文件不是所有部分的链接。一旦我将它添加到 Any SDK 部分,错误就解决了。

enter image description here

在此处输入图片说明