ios 缺少推送通知权利警告

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

Missing Push Notification Entitlement warning

iosapple-push-notifications

提问by Bis

We have created an App ID, distribution certificate and provisioning profile. Push Notifications were not initially enabled.

我们已经创建了一个 App ID、分发证书和配置文件。最初未启用推送通知。

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 中开启了推送通知,检查配置文件,配置文件无效,更新它,并下载最新的配置文件以备下次使用。

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 收到以下电子邮件:

Dear developer,

We have discovered one or more issues with your recent delivery for "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. 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. 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. You may remove the API from future submissions to stop this warning. If you use a third-party framework, you may need to contact the developer for information on removing the API.

After you've corrected the issues, you can use Xcode or Application Loader to upload a new binary to iTunes Connect.

亲爱的开发者,

我们发现您最近交付的“Swanvi”存在一个或多个问题。您的交付成功,但您可能希望在下次交付时更正以下问题:

缺少推送通知权利 - 您的应用程序似乎包括用于注册 Apple 推送通知服务的 API,但应用程序签名的权利不包括“aps-environment”权利。如果您的应用程序使用 Apple 推送通知服务,请确保您的应用程序 ID 在配置门户中启用推送通知,并在使用包含“aps-environment”权利的分发配置文件对您的应用程序进行签名后重新提交。有关更多信息,请参阅本地和推送通知编程指南中的“供应和开发”。如果您的应用程序不使用 Apple 推送通知服务,则无需执行任何操作。您可以从以后的提交中删除 API 以停止此警告。如果您使用第三方框架,

更正问题后,您可以使用 Xcode 或 Application Loader 将新的二进制文件上传到 iTunes Connect。

We have re-checked the App ID. Push Notifications are enabled for development and production.

我们已经重新检查了 App ID。为开发和生产启用推送通知。

In the Provisioning Profile, the Push Notifications option is shown.

在供应配置文件中,显示了推送通知选项。

Why are we getting this warning via email?

为什么我们会通过电子邮件收到此警告?

回答by Anish Kumar

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 ActiveiOS Distribution Provisioning Profiles you need for your app. Then click on it and make sure Enabled Serviceshas Push Notificationenabled. If it doesn't then click on edit and enable it by following the steps provided by Apple. If it is enabled then perfect.

第 1 步:转到https://developer.apple.com/account/ios/certificate/并查看Active您的应用程序所需的iOS 分发配置文件。然后单击它并确保Enabled ServicesPush Notification启用。如果没有,则单击编辑并按照 Apple 提供的步骤启用它。如果启用则完美。

distribution link

分销链接

STEP 2:Delete any InvalidProvisioning Profiles you see related to app (just the invalid ones for YOUR app). I'll tell you why in the following steps.

第 2 步:删除Invalid您看到的与应用程序相关的任何配置文件(仅适用于您的应用程序的无效配置文件)。我将在以下步骤中告诉您原因。

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. This will replace local provisioning profiles with current ones. Click DONE.

第 3转到 Xcode -> 首选项 -> 查看详细信息(对于您的帐户)-> [可选:为了确保无效的一个已经消失,rt-单击任何配置文件,选择“在 Finder 中显示”,然后删除/移动该文件夹中的所有配置文件。] 现在单击下载所有配置文件。这将用当前的配置文件替换本地配置文件。单击完成。

STEP 4:Go to your app Targets -> Build Settings -> In Code Signing, expand your Provisioning Profile to show Debugand Releasetabs. 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). For Release, to be on a safer side, select the ActiveProvisioning Profile with enabled Push Notifications as seen on step 1.

第 4 步:转到您的应用程序目标 -> 构建设置 -> 在代码签名中,展开您的配置文件以显示DebugRelease选项卡。默认情况下,它将处于自动状态(这就是为什么您的应用程序可能会自动使用我们刚刚在第 2 步中删除的无效配置文件)。为了Release更安全,请选择Active启用推送通知的配置文件,如步骤 1 所示。

That's it.

就是这样。

You shouldn't get any emails now.

你现在不应该收到任何电子邮件。

回答by Steven de Salas

@Djeeraj V.S. is correct. Cordova added some conditional compilation to remove this requirement for apps that do not need Push notifications.

@Djeeraj VS 是正确的。Cordova 添加了一些条件编译,以消除不需要推送通知的应用程序的这一要求。

You could comment out the code in in Classes\AppDelegate.has per this answer, but its better to add the compilation symbol DISABLE_PUSH_NOTIFICATIONSvia the UI so you can continue to benefit from future Cordova upgrades.

您可以Classes\AppDelegate.h根据此答案注释掉代码,但最好DISABLE_PUSH_NOTIFICATIONS通过 UI添加编译符号,以便您可以继续从未来的 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 中完成的方式):

enter image description here

在此处输入图片说明

Hope this helps other people out there in same situation.

希望这可以帮助其他处于相同情况的人。

回答by Vyacheslav

In my case I've just checked again 'Capabilities' page inside project properties and pressed 'fixed issue' in the correspond APNS menu. Now it have to look like this enter image description here

就我而言,我刚刚再次检查了项目属性中的“功能”页面,并在相应的 APNS 菜单中按下了“已解决的问题”。现在它必须看起来像这样 在此处输入图片说明

XCode 11.To handle press on Capability button (+)

XCode 11.处理按下 Capability 按钮 (+)

enter image description here

在此处输入图片说明

回答by Rohit Mandiwal

In my case, following practice worked. Xcode 9.2

就我而言,以下练习有效。Xcode 9.2

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

回答by neo

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-environmentand 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. - If it's not, then regenerate it. 2- If your distribution profile is valid, then in XCode, navigate to Preferencesand then click View Details. At this point under Provisioning Profiles, make sure you don't have invalid distribution provisioning files. 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 Signingand for everything choose the distribution provisioning profile.

1- 确保您的分发配置文件在 Apple 的门户中有效。- 如果不是,则重新生成它。2- 如果您的分发配置文件有效,则在 XCode 中,导航到Preferences,然后单击View Details。此时在Provisioning Profiles 下,确保您没有无效的分发配置文件。如果有无效的,则右键单击并将它们移至垃圾箱。如果您没有有效的,请从门户网站下载。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 并且不会出现警告电子邮件。

回答by Lirianna

I have a cordova app, where I have had notifications previously, but wanted to remove it from the app. 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.

我有一个cordova 应用程序,我之前在其中收到过通知,但想从应用程序中删除它。我尝试按照上述答案进行操作,但是在上传构建时仍然遇到此问题。我意识到,我安装了一个插件,它使用了通知设置,并以某种方式为通知激活了一些设置。

I solved the issue by removing the ios platform completely cordova platform rm ios, adding it again cordova platform add iosand making sure that the plugin was removed from the ios.jsonand fetch.jsonfiles.

我通过完全删除 ios 平台解决了这个问题,cordova platform rm ios再次添加它cordova platform add ios并确保从ios.jsonfetch.json文件中删除了插件。