ios 缺少推送通知权利

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

Missing Push Notification Entitlement

iosnotificationsapple-push-notifications

提问by Sasi M

I have received a warning mail from Apple after submitting the binary build.

提交二进制版本后,我收到了来自 Apple 的警告邮件。

    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.

I am not using Push notifications or any third party frameworks like Coredova but I am not sure why I am getting this warning again and again. I have gone through the following links but everywhere it is third party framework issue.

我没有使用推送通知或任何第三方框架,如 Coredova,但我不确定为什么我一次又一次地收到此警告。我已经浏览了以下链接,但到处都是第三方框架问题。

I don't want to enable push notification service as I am not going to use it in my app. Any help would be appreciated to fix this warning. Thanks in advance.

我不想启用推送通知服务,因为我不会在我的应用程序中使用它。任何帮助修复此警告将不胜感激。提前致谢。

Note : Already several times I have tried deleting and re-creating my profiles and certificates.

注意:我已经多次尝试删除并重新创建我的配置文件和证书。

Missing Push Notification Entitlement warning

缺少推送通知权利警告

Missing Push Notification Entitlement

缺少推送通知权利

IOS Missing Push notification entitlement

IOS 缺少推送通知权利

回答by Sten

I am pretty certain that it is a bug in Apples checking system. I uploaded an app yesterday and got this message. This app has been updated at least 30 times without any problems. I didn't add any push notification code in the last version and I don't use any frameworks like PhoneGap or Cordova that could cause this message. It doesn't appear under notifications on the device.

我很确定这是苹果检查系统中的一个错误。我昨天上传了一个应用程序并收到了这条消息。此应用程序已更新至少 30 次,没有任何问题。我没有在上一个版本中添加任何推送通知代码,也没有使用任何可能导致此消息的框架,例如 PhoneGap 或 Cordova。它不会出现在设备的通知下方。

I have searched the app for push notification code without finding anything:

我在应用程序中搜索了推送通知代码,但没有找到任何内容:

grep -r "registerUserNotificationSettings" .
grep -r "registerForRemoteNotificationTypes" .

grep -r "registerUserNotificationSettings" 。
grep -r "registerForRemoteNotificationTypes" 。

I finally tried to upload the previous version that was approved in July (and didn't generate an email). This this time I got the warning email also for this version. So I think that Apple is wrong and I will take my chances and hope it will be approved despite the warning.

我终于尝试上传7月份批准的先前版本(并且没有生成电子邮件)。这次我也收到了这个版本的警告邮件。所以我认为苹果是错误的,我会抓住机会,希望尽管有警告,但它会被批准。



EDIT: Found this reply from an Apple staff in Apple Developer Forum:

编辑:在 Apple Developer Forum 中找到了一位 Apple 员工的回复:

"That notice is a warning only, not a rejection.

“该通知只是警告,而不是拒绝。

The app validator checks for an implementation of the UIApplicationDelegate method application:didRegisterForRemoteNotificationsWithDeviceToken: in the app. You'll get the warning you described if your app delegate implements that method and there is no aps-environment entitlement.

应用验证器检查应用中 UIApplicationDelegate 方法 application:didRegisterForRemoteNotificationsWithDeviceToken: 的实现。如果您的应用程序委托实现了该方法并且没有 aps-environment 权利,您将收到您描述的警告。

It's possible that a third-party library you're using has implemented that method even though your app doesn't do anything with push notifications. In that case you can just ignore the warning. It's there to let developers who do use push notifications know if they might have signed their app incorrectly."

即使您的应用程序没有对推送通知执行任何操作,您使用的第三方库也可能实现了该方法。在这种情况下,您可以忽略警告。它可以让使用推送通知的开发人员知道他们是否可能错误地签署了他们的应用程序。”



EDIT 2: I now have two different apps that have been approved without any problems despite generating the warning email

编辑 2:尽管生成了警告电子邮件,但我现在有两个不同的应用程序已被批准而没有任何问题

回答by Ferschae Naej

Here are a few things you might want to double check:

以下是您可能需要仔细检查的一些事项:

Apple Developer Center

苹果开发者中心

In the section Identifiers> App IDs, Push Notificationsshould not be enabled if you are not implementing them.

Identifiers> App IDs 部分,如果您没有实现推送通知,则不应启用它们。

Apple Developer Center: Application Services

Apple 开发者中心:应用程序服务

You will have to generate a new mobile provisioning each time your enable or disable a service. Make sure Push Notificationsis not listed in your app enabled services:

每次启用或禁用服务时,您都必须生成新的移动配置。确保推送通知未在您的应用启用服务中列出:

enter image description here

在此处输入图片说明

Xcode project target settings

Xcode 项目目标设置

In the Capabilitiestab of your application target, Push Notificationsshould be turned off.

在应用程序目标的Capabilities选项卡中,应该关闭推送通知

Also, in Background Modes, there should not be any Remote Notificationsmode.

此外,在后台模式中,不应有任何远程通知模式。

enter image description here

在此处输入图片说明

Application Delegate

申请委托

Finally, make sure you're not having your application delegate registering for remote notifications and that it is not implementing any remote notification delegate methods. You should make sure the following methods are not called or implemented:

最后,确保您的应用程序委托没有注册远程通知,并且没有实现任何远程通知委托方法。您应该确保未调用或实现以下方法:

  • registerForRemoteNotifications()(registerForRemoteNotificationTypes()prior to iOS 8.0)
  • unregisterForRemoteNotifications()
  • isRegisteredForRemoteNotifications()
  • application(_:didRegisterForRemoteNotificationsWithDeviceToken:)
  • application(_:didFailToRegisterForRemoteNotificationsWithError:)
  • application(_:didReceiveRemoteNotification:fetchCompletionHandler:)
  • application(_:handleActionWithIdentifier:forRemoteNotification:completionHandler:)
  • application(_:didReceiveRemoteNotification:)
  • registerForRemoteNotifications()registerForRemoteNotificationTypes()之前iOS 8.0
  • unregisterForRemoteNotifications()
  • isRegisteredForRemoteNotifications()
  • application(_:didRegisterForRemoteNotificationsWithDeviceToken:)
  • application(_:didFailToRegisterForRemoteNotificationsWithError:)
  • application(_:didReceiveRemoteNotification:fetchCompletionHandler:)
  • application(_:handleActionWithIdentifier:forRemoteNotification:completionHandler:)
  • application(_:didReceiveRemoteNotification:)

Hope that helps!

希望有帮助!

回答by SuanMei

For me too looks like a bug from Apple. The latest version of my app got the warning as well, yet was approved within a week. In this new version I am using an extremely simple Today widget. Thus, I have to link the NotificationCenter framework. The widget reports some data from the containing app. To do so, it simply uses the NSUserDefaults which are shared via the App Groups entitlement. Nothing remotely as sofisticated as push notification.

对我来说,它看起来也像是 Apple 的错误。我的应用程序的最新版本也收到了警告,但在一周内就获得了批准。在这个新版本中,我使用了一个非常简单的 Today 小部件。因此,我必须链接 NotificationCenter 框架。小部件报告来自包含应用程序的一些数据。为此,它只需使用通过 App Groups 权利共享的 NSUserDefaults。没有什么比推送通知更复杂的了。

Apple writes that push notification can be used to manage Today widgets:

Apple 写道,推送通知可用于管理 Today 小部件:

https://developer.apple.com/library/ios/documentation/General/Conceptual/ExtensibilityPG/NotificationCenter.html

https://developer.apple.com/library/ios/documentation/General/Conceptual/ExtensibilityPG/NotificationCenter.html

Perhaps for that reason including the NotificationCenter framework did trigger the warning, albeit mistakenly.

也许是因为这个原因,包括 NotificationCenter 框架确实触发了警告,尽管是错误的。

回答by mgm

I am receiving the same email but it seems to only be a warning and my apps managed to get approved to the store.

我收到了同样的电子邮件,但它似乎只是一个警告,我的应用程序设法获得了商店的批准。

I have an app that I have been updating in the past 2 years, it does not have push notifications and it's been all good so far until my recent release when I got this warning. After contacting Apple it seems this is just a warning and should not be considered. I think it's an error on their side so hopefully they will get it fixed in the next Xcode update.

我有一个应用程序,我在过去 2 年里一直在更新,它没有推送通知,到目前为止一切都很好,直到我最近发布时收到此警告。在联系 Apple 后,这似乎只是一个警告,不应予以考虑。我认为这是他们的错误,所以希望他们能在下一次 Xcode 更新中修复它。

回答by Amit Ajmera

Go to Target > Capabilities,

转到目标 > 能力,

Push notification should be enabled without any issues and Background mode also should be enabled.

推送通知应该没有任何问题地启用,并且还应该启用后台模式。

回答by SoliQuiD

I got this warning just by updating some pods (FacebookSDK is one of them). I assume one of them is implementing the UIApplicationDelegatemethod application:didRegisterForRemoteNotificationsWithDeviceToken:which is why i'll just ignore the warning from now on.

我只是通过更新一些 pod(FacebookSDK 就是其中之一)就收到了这个警告。我假设其中一个正在实施该UIApplicationDelegate方法application:didRegisterForRemoteNotificationsWithDeviceToken:,这就是为什么从现在开始我将忽略警告。

回答by Anish Kumar

After 1 month of intensive research and trails, this worked for me: Missing Push Notification Entitlement warning

经过 1 个月的深入研究和跟踪,这对我有用缺少推送通知权利警告

回答by Rony Rozen

I would start by searching the code for registerForRemoteNotificationTypesor registerUserNotificationSettings, which are both used to register for push notifications (depending on the version of the OS).

我首先搜索registerForRemoteNotificationTypesor的代码registerUserNotificationSettings,它们都用于注册推送通知(取决于操作系统的版本)。

If you find one of them, that's the issue. You need to remove them, if you're not using notifications.

如果您找到其中之一,那就是问题所在。如果您不使用通知,则需要删除它们。

Perhaps the issue is that you're using Local notifications and accidentally registering for remote notifications as well?

也许问题在于您正在使用本地通知并且不小心注册了远程通知?