简体   繁体   English

缺少推送通知权利

[英]Missing Push Notification Entitlement

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.缺少推送通知权利 - 您的应用似乎注册了 Apple 推送通知服务,但应用签名的权利不包括“aps-environment”权利。 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 推送通知服务,请确保您的应用程序 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?这是此错误消息和苹果拒绝的原因,我该如何解决?

Yes, that's the cause of the App Store rejection.是的,这就是 App Store 拒绝的原因。 If your ad-hoc provisioning profile has the aps-environment key, it means your app is configured correctly in the Apple Provisioning Portal.如果您的 ad-hoc 配置文件具有 aps-environment 键,则意味着您的应用程序已在 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.您需要做的就是删除本地计算机上的 App Store 分发配置文件,然后从 Provisioning Portal 重新下载并安装分发配置文件。 This new one should contain the aps-environment key.这个新的应该包含 aps-environment 键。

First App ID第一个应用 ID

make sure your ID push notification enable in production side确保您的 ID 推送通知在生产端启用

as appear in picture如图所示

在此处输入图像描述

Second Certificate二级证书

from production section create two certificate with your id (push notification enabled)从生产部分创建两个带有您的 ID 的证书(启用推送通知)

App Store and Ad Hoc certificate App Store 和 Ad Hoc证书

Apple Push Notification service SSL (Sandbox) certificate Apple 推送通知服务 SSL(沙盒)证书

在此处输入图像描述

Third Provisioning Profiles第三个配置文件

From Distribution section create App Store profile with your id从分发部分使用您的 ID 创建App Store配置文件

Finally最后

while you upload your bin , you must check what provisioning profile used and have many entitlements当您上传您的 bin 时,您必须检查所使用的配置文件并拥有许多权利

在此处输入图像描述

this all cases cause this problem hope this be helpful with you这所有情况都会导致这个问题希望这对你有帮助

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 中,除了启用条款和证书上的所有内容之外,您还需要在目标上的 Capabilities 选项卡中启用推送: Xcode 8 "the aps-environment entitlement is missing from the app's signature" on submit

My blog post about this here .我的博客文章在这里

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.我收到这条消息的原因不同——我通过 Xcode 提交了一个应用程序,而没有首先专门为该应用程序创建 App Store 分发配置文件。 I believe Xcode automatically uses a wildcard App Store profile if you have one installed.我相信如果您安装了一个通配符 App Store 配置文件,Xcode 会自动使用通配符。 But an app uses Push Notifications requires its own profile.但是使用推送通知的应用程序需要自己的配置文件。

The fix is to create a new App Store Distribution profile for the app.解决方法是为应用创建一个新的 App Store Distribution 配置文件。 Then you download it, drag it onto Xcode, and modify your project Build Settings > Code Signing > Release to use the new profile.然后你下载它,把它拖到 Xcode 上,然后修改你的项目 Build Settings > Code Signing > Release 以使用新的配置文件。

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

修复我选项

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 概述的标准方式创建了新的 dev / prod 推送证书(我不会在这里详细介绍,更新时网上有很多关于它的信息您的推送证书可以再使用一年)。

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.不管我们做什么,在提交我们的应用程序后,我们都会收到来自 Apple 的这封电子邮件。 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 会员中心检查分发配置文件的设置时,一切看起来都很好(为 prod / dev 的 App ID 启用了推送,并且我们的分发配置文件仍然连接到这个 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)创建一个指向您的 App ID 的新分发配置文件(保持当前的完整)
  2. In Xcode, refresh your provisioning profiles via Settings > Accounts > Select your account > Details > Click the refresh icon在 Xcode 中,通过 Settings > Accounts > Select your account > Details > 单击刷新图标刷新您的配置文件
  3. Manually create an entitlements plist file for your app:为您的应用手动创建一个权利 plist 文件:
    • File menu > New File...文件菜单 > 新建文件...
    • Select iOS > Resource > Property List选择 iOS > 资源 > 属性列表
    • Name the new file "foo.entitlements" (typically, "foo" is the target name)将新文件命名为“foo.entitlements”(通常,“foo”是目标名称)
    • 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)确保在目标的构建设置中使用此权利文件(目标 > 构建设置 > 搜索“权利”,在 CODE_SIGN_ENTITLEMENTS 中设置您刚刚创建的权利文件的路径)
  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)确保 Target 中的配置文件/代码签名身份正确设置为适当的分发配置文件/签名身份(这应该很明显)
  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我不是 100% 确定这是否会影响它(它不应该因为目标设置覆盖项目设置,但我还是这样做了),确保您的项目的配置文件/签名身份与您的目标匹配
  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"在名为“aps-environment”的权利文件中添加一个新条目,并将其值设置为“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.确保该值与以前版本中使用的值相同(您可以通过在 Organizer 中查找以前的版本来找到该值,尝试提交到应用商店,选择您的团队,然后在提交应用程序之前点击旁边的箭头“(X) Entitlements” 字符串以展开权利并查看 keychain-access-group 权利的值。
  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.返回 Apple 会员中心并删除您在步骤 1 中创建的新配置文件。
  12. Back in Xcode, refresh your provisioning profiles list once again by repeating step 2.回到 Xcode,通过重复步骤 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.现在再次归档您的应用程序,您应该会看到该应用程序是使用您想要使用的旧分发配置文件构建的,并且正确地具有 aps-environment 权利。 Submit and you're done.提交,你就完成了。

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.我列出的部分或大部分步骤也很有可能不是必需的,我将它们放在这里是因为我做了它们,它们可能已经导致了最终解决方案。

在 iOS 配置门户中的 developer.apple.com 上检查您的 App Id 是否已启用 Push 如果没有,则为您的 App Id 配置您的 Push SSL 证书在你的 Xcode 库中

I was also facing this issue even I was not using push notifications at all in my app.Making new provisioning profile also 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.然后新提交的带有此配置文件的构建被批准,没有任何警告。

This was what fixed it for me.这就是为我解决的问题。 (I had already tried toggling the capabilities on/off, recreating the provisioning profile, etc). (我已经尝试过打开/关闭功能,重新创建配置文件等)。

In the Build Settings tab, in Code Signing Entitlements , my .entitlements file wasn't link for all sections.Build Settings选项卡的Code Signing Entitlements中,我的.entitlements文件不是所有部分的链接。 Once I added it to the Any SDK section, the error was resolved.一旦我将它添加到 Any SDK 部分,错误就解决了。

在此处输入图像描述

我遇到了同样的问题,我的解决方案是从 Target -> Capabilities 添加推送通知权利。

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.这从 .entitlements 文件中删除了 APNS 的“权利”设置。

I had this problem because my entitlements file was malformed due to previous manual editing.我遇到了这个问题,因为我的权利文件由于以前的手动编辑而格式错误。 I removed the wrongly formatted entitlement entry syntax and then i could click "fix" in the capabilities tab and Xcode added the entitlement to my file.我删除了格式错误的权利条目语法,然后我可以单击功能选项卡中的“修复”,Xcode 将权利添加到我的文件中。

Here is an example of a properly formatted entitlements file (" Runner.entitlements "):以下是格式正确的权利文件(“ Runner.entitlements ”)的示例:

<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>aps-environment</key>
    <string>development</string>
    <key>com.apple.developer.applesignin</key>
    <array>
        <string>Default</string>
    </array>
</dict>
</plist>

FIX IDEA Hey guys so i have made an app and did not used any push notification functions but i still got an email. FIX IDEA嘿伙计们,所以我制作了一个应用程序并且没有使用任何推送通知功能,但我仍然收到一封电子邮件。 After checking the certificates, ids and profiles of the bundle identifier i used to create my app in apple store connect in the apple developer portal i realized that push notificiations were turned on.在检查了我用来在苹果商店中创建我的应用程序的捆绑标识符的证书、ID 和配置文件后,在苹果开发者门户中连接我意识到推送通知已打开。

What you have to do is:你要做的是:

go to apple developer login site where you can manage your certificates aso 2. select "Certificates, IDs and Profiles" Tab on the right side 3. now select "Identifiers" 4. and the bundle id from the list to the right 5. now scroll down till you see push notification 6. turn it off 7. archive your build and reupload it to Apple Store Connect转到苹果开发者登录网站,您可以在其中管理您的证书 2. 选择右侧的“证书、ID 和配置文件”选项卡 3. 现在选择“标识符” 4. 以及右侧列表中的捆绑 ID 5. 现在向下滚动直到看到推送通知 6. 将其关闭 7. 归档您的构建并将其重新上传到 Apple Store Connect

Hope it helps!希望能帮助到你!

In my case, even I created a myapp.profile and set it in xcode manually, and when I chose "show in finder" and located the embedded.mobileprovision and checked to make sure aps-environment is there in the file, the error was still there.就我而言,即使我创建了一个 myapp.profile 并在 xcode 中手动设置它,当我选择“在 finder 中显示”并找到 Embedded.mobileprovision 并检查以确保文件中存在 aps-environment 时,错误是还在那里。

I then went to developer center and found that the status of XC: myapp.profile is invalid.然后我去开发者中心,发现XC:myapp.profile的状态无效。 I updated it and installed the XC: myapp.profile and it worked fine.我更新了它并安装了 XC:myapp.profile,它运行良好。

I think xcode is trying to manage the profile and you need to check the provisioning profile when you submit your binary to store, and ensure it is the correct one.我认为 xcode 正在尝试管理配置文件,当您将二进制文件提交到存储时,您需要检查配置文件,并确保它是正确的。 And according to other answers it can be caused for various reasons so it can be really annoying.根据其他答案,这可能是由于各种原因造成的,因此真的很烦人。

UPDATE:更新:

Once you've signed with the downloaded profile and confirmed that aps-environment was there when you try to submit to App Store , you should be able to change the profile and code signing entity to automatic and iOS Developer .一旦您使用下载的配置文件签名并确认在您尝试提交到App Store时存在aps-environment ,您应该能够将配置文件和代码签名实体更改为自动和iOS Developer Hope it can be improved in Xcode 7.希望它可以在 Xcode 7 中得到改进。

There are some really good suggestions on here.这里有一些非常好的建议。

Referring to the last screenshot that Mina provided, after initially archiving my app, the provisioning profile mentioned during uploading contained a wildcard (XC.*).参考 Mina 提供的最后一个屏幕截图,在最初归档我的应用程序后,上传期间提到的配置文件包含通配符 (XC.*)。 This is wrong.这是错误的。

It took some considerable effort in order to resolve this.为了解决这个问题,付出了相当大的努力。 I had to perform a combination of the suggestions that Simon Woodside & Mina Fawzy provided.我必须综合执行 Simon Woodside 和 Mina Fawzy 提供的建议。

If you have any existing certificates and provisioning profiles related to your project, now would be a good time to remove them all locally, and revoke them all remotely.如果您有任何与您的项目相关的现有证书和配置文件,现在是在本地删除它们并远程撤销它们的好时机。 Give yourself a fresh start.给自己一个新的开始。

Mina Fawzy's detailed suggestion is excellent. Mina Fawzy 的详细建议非常好。 Performing Mina's suggestion, if performed correctly, should take care of you online.执行 Mina 的建议,如果执行正确,应该会在网上照顾您。

Enter Simon's suggestion.输入西蒙的建议。 Two things I needed to check inside my project.我需要在我的项目中检查两件事。 Using XCode, go here:使用 XCode,去这里:

PROJECT -> BUILD SETTINGS -> CODE SIGNING项目 -> 构建设置 -> 代码签名

Review the Code Signing Identity and Provisioning Profile properties.查看代码签名身份供应配置文件属性。 Make sure you set those two properties to that of your project name.确保将这两个属性设置为项目名称。 Don't allow XCode to automatically select for you, and don't use some generic code signing identity (eg Iphone Developer).不要让 XCode 自动为您选择,也不要使用一些通用的代码签名身份(例如 Iphone Developer)。

Make sure you can actually install the app onto your devices before deciding to archive.在决定存档之前,请确保您可以将应用程序实际安装到您的设备上。

The biggest problem that i have after enabling the Push Notification from Capabilities and remaking all the certificates is that the Target name and the folder name where was stored the project was composed from 2 strings separated by space.在启用来自CapabilitiesPush Notification并重新制作所有证书后,我遇到的最大问题是目标名称和存储项目的文件夹名称由 2 个用空格分隔的字符串组成。 After removing the space all worked just fine!删除空间后一切正常!

In Flutter在颤振中

You can add a file Runner.entitlements under ios/Runner with below content and after created your file parh will be like ios/Runner/Runner.entitlements :您可以在ios/Runner下添加一个文件Runner.entitlements ,内容如下,创建后您的文件 parh 将类似于ios/Runner/Runner.entitlements

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>aps-environment</key>
    <string>development</string>
</dict>
</plist>

This happened to me suddenly because my app's distribution profile had expired.这突然发生在我身上,因为我的应用程序的分发配置文件已过期。 Xcode began using the wildcard profile instead, which did not have the push notification entitlement enabled. Xcode 开始使用通配符配置文件,它没有启用推送通知权利。 I didn't receive any warning.我没有收到任何警告。 The fix was easy;修复很容易; I just had to generate another distribution profile for my app in the Apple Developer Member Center, download it, and double-click to install in Xcode.我只需要在 Apple Developer Member Center 中为我的应用程序生成另一个分发配置文件,下载它,然后双击安装到 Xcode 中。

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

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