简体   繁体   English

缺少推送通知授权警告

[英]Missing Push Notification Entitlement warning

We have created an App ID, distribution certificate and provisioning profile.我们已经创建了 App ID、分发证书和配置文件。 Push Notifications were not initially enabled.推送通知最初未启用。

We now need to implement Push Notifications in the app.我们现在需要在应用程序中实现推送通知。

We have enable Push Notifications in the App D, check the provisioning profile, the provisioning profile was invalid, updated it, and downloaded the latest provisioning profile to use it for next time.我们在App D中启用了Push Notifications,检查provisioning profile,provisioning profile无效,更新了它,并下载了最新的provisioning profile以供下次使用。

We then integrate the APIs for Push Notifications via APNS in our code.然后,我们在代码中通过 APNS 集成用于推送通知的 API。

After uploading the app in iTunesConnect, we get the following email from Apple:在 iTunesConnect 中上传应用程序后,我们从 Apple 获得以下 email:

Dear developer,亲爱的开发者,

We have discovered one or more issues with your recent delivery for "Swanvi".我们发现您最近交付的“Swanvi”存在一个或多个问题。 Your delivery was successful, but you may wish to correct the following issues in your next delivery:您的交付已成功,但您可能希望在下次交付时更正以下问题:

Missing Push Notification Entitlement - Your app appears to include API used to register with the Apple Push Notification service, but the app signature's entitlements do not include the "aps-environment" entitlement.缺少推送通知权利 - 您的应用程序似乎包含用于注册 Apple 推送通知服务的 API,但应用程序签名的权利不包括“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”权利的分发配置文件签署您的应用程序后重新提交。 See "Provisioning and Development" in the Local and Push Notification Programming Guide for more information.有关详细信息,请参阅本地和推送通知编程指南中的“供应和开发”。 If your app does not use the Apple Push Notification service, no action is required.如果您的应用程序不使用 Apple 推送通知服务,则无需执行任何操作。 You may remove the API from future submissions to stop this warning.您可以从以后的提交中删除 API 以停止此警告。 If you use a third-party framework, you may need to contact the developer for information on removing the API.如果您使用第三方框架,您可能需要联系开发人员以获取有关删除 API 的信息。

After you've corrected the issues, you can use Xcode or Application Loader to upload a new binary to iTunes Connect.更正问题后,您可以使用 Xcode 或 Application Loader 将新的二进制文件上传到 iTunes Connect。

We have re-checked the App ID.我们已经重新检查了 App ID。 Push Notifications are enabled for development and production.为开发和生产启用推送通知。

In the Provisioning Profile, the Push Notifications option is shown.在配置文件中,显示了推送通知选项。

Why are we getting this warning via email?为什么我们通过 email 收到此警告?

You need to see 2 things : The provisioning profiles used by your account on Xcode and the ones on developer.apple您需要查看两件事:您的帐户在 Xcode 上使用的配置文件和 developer.apple 上的配置文件

Its all about the provisioning profiles.它全都与配置文件有关。

STEP 1 : Go to https://developer.apple.com/account/ios/certificate/ and see the Active iOS Distribution Provisioning Profiles you need for your app.第 1 步:转到https://developer.apple.com/account/ios/certificate/并查看您的应用程序所需的Active iOS Distribution Provisioning Profiles。 Then click on it and make sure Enabled Services has Push Notification enabled.然后单击它并确保Enabled Services已启用Push Notification If it doesn't then click on edit and enable it by following the steps provided by Apple.如果没有,则单击编辑并按照 Apple 提供的步骤启用它。 If it is enabled then perfect.如果启用则完美。

分销链接

STEP 2: Delete any Invalid Provisioning Profiles you see related to app (just the invalid ones for YOUR app).第 2 步:删除您看到的与应用程序相关的任何Invalid配置文件(仅适用于您的应用程序的Invalid配置文件)。 I'll tell you why in the following steps.我将在以下步骤中告诉您原因。

STEP 3: Go to Xcode -> Preference -> View Details (for your Account) -> [OPTIONAL: To be sure invalid one is gone, rt-click on any provisioning profile, select "Show in Finder", then Delete/Move all the provisioning profiles from that folder.] Now click Download All Profiles.第 3转到 Xcode -> 首选项 -> 查看详细信息(对于您的帐户)-> [可选:为了确保无效的一个已经消失,rt-单击任何配置文件,选择“在 Finder 中显示”,然后删除/移动该文件夹中的所有配置文件。] 现在单击下载所有配置文件。 This will replace local provisioning profiles with current ones.这将用当前的配置文件替换本地配置文件。 Click DONE.单击完成。

STEP 4: Go to your app Targets -> Build Settings -> In Code Signing, expand your Provisioning Profile to show Debug and Release tabs.第 4 步:转到您的应用程序目标 -> 构建设置 -> 在代码签名中,展开您的配置文件以显示DebugRelease选项卡。 By default it will be on Automatic (which is why your app was probably automatically using the invalid profile that we just deleted in step 2).默认情况下,它将处于自动状态(这就是为什么您的应用程序可能会自动使用我们刚刚在第 2 步中删除的无效配置文件)。 For Release , to be on a safer side, select the Active Provisioning Profile with enabled Push Notifications as seen on step 1.对于Release ,为了更安全,请选择启用了推送通知的Active Provisioning Profile,如步骤 1 所示。

That's it.就是这样。

You shouldn't get any emails now.你现在不应该收到任何电子邮件。

@Djeeraj VS is correct. @Djeeraj VS 是正确的。 Cordova added some conditional compilation to remove this requirement for apps that do not need Push notifications. Cordova 添加了一些条件编译,以消除不需要推送通知的应用程序的这一要求。

You could comment out the code in in Classes\\AppDelegate.h as per this answer , but its better to add the compilation symbol DISABLE_PUSH_NOTIFICATIONS via the UI so you can continue to benefit from future Cordova upgrades.您可以按照此答案注释掉Classes\\AppDelegate.h的代码,但最好通过 UI 添加编译符号DISABLE_PUSH_NOTIFICATIONS以便您可以继续从未来的 Cordova 升级中受益。

I come from .NET background so i am familiar with conditional compilation but had to spend a bit of time working out how to get the compiler flag working in XCode.我来自 .NET 背景,所以我熟悉条件编译,但不得不花一些时间研究如何让编译器标志在 XCode 中工作。

Turns out the magic word here is 'Preprocessor Macro'.原来这里的神奇词是“预处理器宏”。 Here is how its done graphically via the UI (note that this the way its done in XCode 6.1):这是通过 UI 以图形方式完成的方式(请注意,这是在 XCode 6.1 中完成的方式):

在此处输入图片说明

Hope this helps other people out there in same situation.希望这可以帮助其他处于相同情况的人。

In my case I've just checked again 'Capabilities' page inside project properties and pressed 'fixed issue' in the correspond APNS menu.就我而言,我刚刚再次检查了项目属性中的“功能”页面,并在相应的 APNS 菜单中按下了“已解决的问题”。 Now it have to look like this现在它必须看起来像这样在此处输入图片说明

XCode 11. To handle press on Capability button (+) XCode 11.处理按下 Capability 按钮 (+)

在此处输入图片说明

I had the same warning and here is how I solved it.我有同样的警告,这是我解决它的方法。

First of all, when you archive your project, under entitlements if you don't see aps-environment and your app uses push notifications, then you will get the warning mentioned in the question.首先,当您归档您的项目时,如果您没有看到aps-environment并且您的应用程序使用推送通知,那么您将收到问题中提到的警告。

FIX STEPS修复步骤

1- Make sure your distribution profile is valid in Apple's Portal. 1- 确保您的分发配置文件在 Apple 的门户中有效。 - If it's not, then regenerate it. - 如果不是,则重新生成它。 2- If your distribution profile is valid, then in XCode, navigate to Preferences and then click View Details . 2- 如果您的分发配置文件有效,则在 XCode 中,导航到Preferences ,然后单击View Details At this point under Provisioning Profiles , make sure you don't have invalid distribution provisioning files.此时在Provisioning Profiles 下,确保您没有无效的分发配置文件。 If there are invalid ones, then make right click and move them to trash.如果有无效的,则右键单击并将它们移至垃圾箱。 If you don't have the valid one, then download it from the Portal.如果您没有有效的,请从门户网站下载。 3- Go to Build Settings -> Code Signing and for everything choose the distribution provisioning profile. 3- 转到Build Settings -> Code Signing并为所有内容选择分发配置文件。

At this point if you archive, you can see aps-environment in your entitlements and the warning email won't come.此时如果您存档,您可以在您的权利中看到 aps-environment 并且不会出现警告电子邮件。

In my case, following practice worked.就我而言,以下练习有效。 Xcode 9.2 Xcode 9.2

  1. Disabled Automatically manage signing which appears in Build Target > Signing禁用Automatically manage signing出现在Build Target > Signing
  2. Import provisioning profile manually.手动导入配置文件。

I fixed that issue by below steps:我通过以下步骤解决了该问题:

  1. Open your project with Xcode使用Xcode打开您的项目
  2. Click the Signing & Capabilities in Runner tab and then click the + Capability button.单击Runner选项卡中的Signing & Capabilities ,然后单击+ Capability按钮。 Type push in the filter field and press Enter.在过滤器字段中键入push ,然后按 Enter。
  3. After adding the push notifications entitlement, the Runner.entitlements file will have been created in your project添加push notifications权利后,将在您的项目中创建Runner.entitlements文件

I have a cordova app, where I have had notifications previously, but wanted to remove it from the app.我有一个cordova 应用程序,我之前在其中收到过通知,但想从应用程序中删除它。 I tried following the above answers, but I still encountered this issue when I uploaded the build.我尝试按照上述答案进行操作,但是在上传构建时仍然遇到此问题。 I realized, that I had a plugin installed, who used the notification setting, and somehow kept some settings activated for notifications.我意识到,我安装了一个插件,它使用了通知设置,并以某种方式为通知激活了一些设置。

I solved the issue by removing the ios platform completely cordova platform rm ios , adding it again cordova platform add ios and making sure that the plugin was removed from the ios.json and fetch.json files.我通过完全删除 ios 平台cordova platform rm ios解决了这个问题,再次添加了cordova platform add ios并确保从ios.jsonfetch.json文件中删除了插件。

2021 Xcode 12.4 2021 年 Xcode 12.4

I had the similar issue.my app uses push notification.我有类似的问题。我的应用程序使用推送通知。 For older release I never got such email from Apple.对于较旧的版本,我从未收到过来自 Apple 的此类电子邮件。 I think there's some issue with the Automatically manage signing.我认为自动管理签名存在一些问题。
Solution Do the Manual app signing解决方案进行手动应用签名

  1. Disabled Automatically manage signing which appears in Signing & Capabilities已禁用 自动管理出现在Signing & Capabilities中的Signing & Capabilities
  2. Import provisioning profile manually.手动导入配置文件。 在此处输入图片说明

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

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