ios 应用程序因“缺少推送通知权利”而被拒绝

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

App rejected because of "Missing Push Notification Entitlement"

iosapple-push-notifications

提问by sandy

Recently my application got rejected while uploading it. The Apple review team says my app is "Missing Push Notification Entitlements"

最近我的申请在上传时被拒绝了。Apple 审核团队说我的应用程序“缺少推送通知权利”

This is the information they have provided:

这是他们提供的信息:

Missing Push Notification Entitlement - Your app registers with the Apple Push Notification Service, but the application signature's entitlements do not include the required "aps-environment" entitlement. Make sure you have enabled Push Notification Services for this app, and that you have downloaded a Distribution provisioning profile that includes the "aps-environment" entitlement.

缺少推送通知权利 - 您的应用程序注册了 Apple 推送通知服务,但应用程序签名的权利不包括所需的“aps-environment”权利。确保您已为此应用程序启用推送通知服务,并且您已下载包含“aps-environment”权利的分发配置文件。

Earlier versions of my app used to have push notifications, and my app binary never got rejected due to that. What should I do here?

我的应用程序的早期版本曾经有推送通知,我的应用程序二进制文件从未因此被拒绝。我应该在这里做什么?

采纳答案by Sagar Mody

Open your Provisioning Profile in any Text Editor and search for "environment".

在任何文本编辑器中打开您的配置文件并搜索“环境”。

You should find: aps-environment

你应该找到: aps-environment

If you don't see aps-environmentin your provisioning profile, there is an issue in your Apple provisioning certificate.

如果您aps-environment在配置文件中没有看到,则您的 Apple 配置证书存在问题。

If you created a certificate without push notifications, and then later on you added Push Notification service, Apple DOESN'T update your provisioning profile.

如果您创建了一个没有推送通知的证书,然后您添加了推送通知服务,Apple 不会更新您的配置文件。

You need to create a NEW provisioning profile. Sign the binary with this new Provisioning Profile and you would be good to go.

您需要创建一个新的配置文件。使用这个新的 Provisioning Profile 对二进制文件进行签名,您就可以开始了。

回答by sandy

I have recreated my Distribution provisioning profile and build my application with it. This change fixed the issue of Missing Push Notification Entitlements.

我重新创建了我的分发配置文件并用它构建了我的应用程序。此更改修复了缺少推送通知权利的问题。

回答by jlapoutre

If you are submitting a Cordova / Phonegap project and you are NOT using push notifications, you should inspect Classes/AppDelegate.mfor the two methods below. Observed in Cordova 3.7.0, not sure about other versions.

如果您正在提交 Cordova / Phonegap 项目并且您没有使用推送通知,您应该检查Classes/AppDelegate.m以下两种方法。在Cordova 3.7.0中观察到,其他版本不确定。

Make sure you are not using remote notifications in any other way (carefully check your plugins as well). Then remove or comment out the following block:

确保您没有以任何其他方式使用远程通知(也请仔细检查您的插件)。然后删除或注释掉以下块:

- (void) application:(UIApplication*)application
    didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken
{
    // re-post ( broadcast )
    NSString* token = [[[[deviceToken description]
        stringByReplacingOccurrencesOfString:@"<" withString:@""]
        stringByReplacingOccurrencesOfString:@">" withString:@""]
        stringByReplacingOccurrencesOfString:@" " withString:@""];

    [[NSNotificationCenter defaultCenter] postNotificationName:CDVRemoteNotification object:token];
}

- (void) application:(UIApplication*)application
    didFailToRegisterForRemoteNotificationsWithError:(NSError*)error
{
    // re-post ( broadcast )
    [[NSNotificationCenter defaultCenter] postNotificationName:CDVRemoteNotificationError object:error];
}

Hope this saves you a few hours ;-)

希望这可以为您节省几个小时;-)

回答by Tatarasanu Victor

I had the same problem and I fixed it by recreating the provisioning profile. From "Provisioning and Development"in the Local and Push Notification Guide:

我遇到了同样的问题,我通过重新创建配置文件来解决它。来自本地和推送通知指南中的“供应和开发”

The Team Admin or Team Agent must next create the provisioning profile (Development or Distribution) used in the server side of remote-notification development. The provisioning profile is a collection of assets that associates developers of an application and their devices with an authorized development team and enables those devices to be used for testing. The profile contains certificates, device identifiers, the application's bundle ID, and all entitlements, including . All team members must install the provisioning profile on the devices on which they will run and test application code.

团队管理员或团队代理接下来必须创建用于远程通知开发的服务器端的配置文件(开发或分发)。供应配置文件是一组资产,它将应用程序的开发人员及其设备与授权的开发团队相关联,并使这些设备能够用于测试。该配置文件包含证书、设备标识符、应用程序的捆绑 ID 和所有权利,包括 . 所有团队成员都必须在他们将运行和测试应用程序代码的设备上安装配置文件。

回答by NaveenRaghuveer

My Case: I have implemented push notifications for an update to my appstore app. As the provisioning profiles prior to the push notification impelmentation becomes invalid, I have created new Appstore-distribution provisioning profile and built the app with new profile and uploaded to store. But I got a mail saying "Missing Push Notification Entitlement".

我的案例:我已实施推送通知以更新我的 appstore 应用程序。由于推送通知实施之前的配置文件无效,我创建了新的 Appstore-distribution 配置文件,并使用新配置文件构建应用程序并上传到商店。但是我收到一封邮件,上面写着“缺少推送通知权利”。

Finding: I found that while archiving, Xcode is using the wrong (invalid/old) provisioning profile. So deleted the old provisioning profile from member centre and it solved the problem

发现:我发现在归档时,Xcode 使用了错误的(无效/旧的)配置文件。所以从会员中心删除了旧的配置文件并解决了问题

Screenshot while validating the archive

验证存档时的屏幕截图

回答by Steven de Salas

I also had this problem with a Cordova app and after doing a bit of reading it seems that this is a common issue nowadays.

我在 Cordova 应用程序中也遇到了这个问题,经过一些阅读后,这似乎是当今的常见问题。

WHY DID IT HAPPEN?

为什么会这样?

Since you mention that your app was already approved using push notifications, the most likely scenario is that the Provisioning Profile for your app was changed when submitting it to the AppStore. Perhaps you:

由于您提到您的应用程序已使用推送通知获得批准,因此最可能的情况是您的应用程序的配置文件在将其提交到 AppStore 时发生了更改。也许你:

  1. rebuilt your project in XCode, or
  2. moved to another computer and forgot to tell XCode what the correct profile was, or
  3. somebody sat on your computer and changed it, or
  1. 在 XCode 中重建您的项目,或
  2. 移动到另一台计算机,忘记告诉 XCode 正确的配置文件是什么,或者
  3. 有人坐在你的电脑前改变了它,或者

This issue happens because permissions are gleaned through the provisioning profile. If you forget to link the provisioning profile for your app to an AppID that has the 'Push Notifications' entitlement (Note that XCode does this automatically by using the wildcard developer provisioning certificate by default) then you are likely to get this message until you sort out the permissioning.

发生此问题是因为权限是通过配置文件收集的。如果您忘记将应用的配置文件链接到具有“推送通知”权限的 AppID(请注意,XCode 默认使用通配符开发人员配置证书自动执行此操作),那么您可能会收到此消息,直到您排序出许可。

HOW TO REMOVE THE NEED FOR PUSH NOTIFICATIONS IN CORDOVA APPS:

如何在 CORDOVA 应用程序中删除推送通知的需要:

I was submitting a Cordova app when I got this message, and while the solution posted by @jlapoutre is enough to get your app approved, you want to continue benefiting from Cordova upgrades so the best thing is to take advantage of conditional compilation (ie triggering the #ifndef DISABLE_PUSH_NOTIFICATIONSdirective which tells XCode to compile you app with this bit of code left out).

当我收到这条消息时,我正在提交一个 Cordova 应用程序,虽然@jlapoutre 发布的解决方案足以让您的应用程序获得批准,但您希望继续从 Cordova 升级中受益,所以最好的办法是利用条件编译(即触发在#ifndef DISABLE_PUSH_NOTIFICATIONS该告知XCode编译你的应用程序与此位的代码指令离开了)。

Conditional compilation is also known as 'Preprocessor Macros' in XCode-speak. This is how the you can accomplish this graphically via the UI (note that this the way its done in XCode 6.1):

条件编译在 XCode 中也称为“预处理器宏”。这是您可以通过 UI 以图形方式完成此操作的方式(请注意,这是在 XCode 6.1 中完成的方式):

enter image description here

在此处输入图片说明

Hope this helps other people out there in same situation.

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

回答by Tim Burks

I received this same error message, and recreating my provisioning profile didn't eliminate it.

我收到了同样的错误消息,重新创建我的配置文件并没有消除它。

Instead I found that my app contained some stray APNS-related symbols (in a library) that weren't being used. Apparently they caused a static analyzer to mark the app as using push notifications (it doesn't). #ifdef-ing out the symbols allowed my app to be accepted without the aps-environment entitlement.

相反,我发现我的应用程序包含一些未使用的与 APNS 相关的杂散符号(在库中)。显然,他们导致静态分析器将应用程序标记为使用推送通知(它没有)。#ifdef-ing out 符号允许我的应用程序在没有 aps-environment 权利的情况下被接受。

回答by chris.o.

I recently encountered this issue after adding a Today Extension to an app with Push Services enabled. Finally realized that the Mobile Provisioning profile generated by Xcode for the Today Extension did not have Push Notifications Services enabled. Once I enabled Push Services for the Today Extension, the warning from Apple went away.

我最近在向启用了推送服务的应用程序添加 Today Extension 后遇到了这个问题。最终意识到 Xcode 为 Today Extension 生成的 Mobile Provisioning 配置文件没有启用推送通知服务。一旦我为 Today Extension 启用推送服务,Apple 的警告就消失了。

回答by Tony

I have same problem. I have solved it.

我有同样的问题。我已经解决了。

I think this problem causes when adding push-notification-function into AppID and no recreating Provisioning. We will receive a warning when adding iCloud-function:

我认为在将推送通知功能添加到 AppID 并且不重新创建 Provisioning 时会导致此问题。添加 iCloud 功能时我们会收到警告:

All new provisioning profiles you create for this App ID will be enabled for iCloud. If you wish to enable iCloud for any existing provisioning profiles associated with this App ID, you must manually regeneratethem

您为此 App ID 创建的所有新配置文件都将启用 iCloud。如果您希望为与此 App ID 关联的任何现有配置文件启用 iCloud,您必须手动重新生成它们

I think when we add some function in AppID, we should manually regenerate all provisionings which are related to that AppID.

我认为当我们在 AppID 中添加一些功能时,我们应该手动重新生成与该 AppID 相关的所有配置。

I think so

我想是这样

回答by Md Mahbubur Rahman

Steps

脚步

  1. Enable Push Notification Service (Production Push SSL Certificate)

  2. Create/Recreate Distribution Provisioning Profile and build your application with updated Distribution Provisioning Profile.

  1. 启用推送通知服务(生产推送 SSL 证书)

  2. 创建/重新创建分发供应配置文件并使用更新的分发供应配置文件构建您的应用程序。

The following resources may help you

以下资源可能对您有所帮助