ios 在应用商店中找不到适用于应用程序的有效“aps-environment”权利字符串

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

No valid 'aps-environment' entitlement string found for application on app store

iosobjective-cxcodeapp-storepush

提问by Jessiah

So I have this app called Dripper that I put out about a month ago and then an update a couple days ago. The update added push notifications and a few little tweaks. I tested it with the sandbox-apn using the development profile and things worked great. Then I switched things to the production-apn and pushed it to test-flight, again things worked perfectly. Once I put update on the market and ran it I noticed I wasn't getting any new push registrations on the server. I looked at the console logs for the device and found this:

所以我有一个名为 Dripper 的应用程序,我大约在一个月前发布了它,然后在几天前进行了更新。该更新添加了推送通知和一些小调整。我使用开发配置文件使用沙箱 apn 对其进行了测试,并且效果很好。然后我将事情切换到 production-apn 并将其推送到试飞,再次一切正常。一旦我在市场上发布更新并运行它,我注意到我没有在服务器上获得任何新的推送注册。我查看了设备的控制台日志,发现了这个:

Dec 4 17:55:15 Ina-touch-it coffco[1210] : Registering for remote notifications
Dec 4 17:55:15 Ina-touch-it SpringBoard[52] : No valid 'aps-environment' entitlement string found for application 'Dripper': (null). Notifications will not be delivered.
Dec 4 17:55:15 Ina-touch-it coffco[1210] <Warning>: Failed to register with error : Error Domain=NSCocoaErrorDomain Code=3000 "no valid 'aps-environment' entitlement string found for application" UserInfo=0x174270900 {NSLocalizedDescription=no valid 'aps-environment' entitlement string found for application}

12 月 4 日 17:55:15 Ina-touch-it coffco[1210]:注册远程通知
12 月 4 日 17:55:15 Ina-touch-it SpringBoard[52]:找不到适用于应用程序的有效“aps-environment”权利字符串'滴头':(空)。将不会发送通知。
12 月 4 日 17:55:15 Ina-touch-it coffco[1210]<Warning>: Failed to register with error : Error Domain=NSCocoaErrorDomain Code=3000 "no valid 'aps-environment' entitlement string found for application" UserInfo=0x174270900 {NSLocalizedDescription=no valid 'aps-environment' entitlement string found for application}

I am a bit confused because I thought that the production-apn would function the same between ad-hoc and app store builds.

我有点困惑,因为我认为生产 apn 在临时构建和应用商店构建之间的功能相同。

Here is my app id and its entitlements -> http://i.stack.imgur.com/uf4pB.png

这是我的应用程序 ID 及其权利 -> http://i.stack.imgur.com/uf4pB.png

Here is the provisioning profile for the apps store -> http://i.stack.imgur.com/AYOV5.png

这是应用商店的配置文件 -> http://i.stack.imgur.com/AYOV5.png

回答by wei

I fix this problem by enabling push notification capability.

我通过启用推送通知功能解决了这个问题。

Click on .xcodeproj -> Capabilities -> Enable Push Notification

点击 .xcodeproj -> Capabilities -> Enable Push Notification

回答by Erwan

I fixed this issue like this:

我像这样解决了这个问题:

  • Go to Xcode "Preferences"
  • Go to "Accounts" tab
  • Select my Apple ID and click "View Details"
  • Click on the arrow on the bottom left corner to refresh
  • Click "Done"
  • 转到Xcode“首选项”
  • 转到“帐户”选项卡
  • 选择我的 Apple ID,然后单击“查看详细信息”
  • 点击左下角的箭头刷新
  • 点击“完成”

And try again!

然后再试一次!

Source:

来源:

回答by Ram G.

You must have to enable Target—> capabilities—> push notification. I have faced this issue using Xcode 8. enter image description here

您必须启用 Target-> 功能-> 推送通知。我使用 Xcode 8 遇到过这个问题。在此处输入图片说明

回答by Fahim Parkar

Such problems are due to current Provisioning Profile does not contain APNS information, as the Provisioning Profile is created BEFORE creating the APNS certificate.

此类问题是由于当前的配置文件不包含 APNS 信息,因为配置文件是在创建 APNS 证书之前创建的。

Therefore, to solve the problem, create a new Provisioning Profile & select the Provisioning Profile in Xcode. Then you are DONE.

因此,要解决此问题,请创建一个新的 Provisioning Profile 并在 Xcode 中选择 Provisioning Profile。然后你就完成了。

Also, when you add push, I believe you have updated the certificates in keychain too.

另外,当您添加推送时,我相信您也更新了钥匙串中的证书。

回答by micaball

Regarding Xcode 9, some of the answers are outdated or incomplete to solve this specific issue.

关于 Xcode 9,一些答案已经过时或不完整,无法解决这个特定问题。

Here was the steps to follow for me:

以下是我要遵循的步骤:

1. Create the Provisioning Profile

1. 创建配置文件

(FCM is not a prerequisitefor push notification but their guides are amazingly clear, here is the link)

FCM 不是推送通知的先决条件,但他们的指南非常清楚,这是链接

To test your app while under development, you need a Provisioning Profile for development to authorize your devices to run an app that is not yet published on the App Store.

要在开发过程中测试您的应用程序,您需要一个用于开发的配置文件来授权您的设备运行尚未在 App Store 上发布的应用程序。

  1. Navigate to the Apple Developer Member Center and sign in.
  2. Navigate to Certificates, Identifiers and Profiles.
  3. In the drop down menu on the top left corner, select iOS, tvOS, watchOS if it's not already selected, then navigate to Provisioning Profiles > All.
  4. Click the + button to create a new Provisioning Profile.
  5. Select iOS App Development as provisioning profile type, then click Continue.
  6. In the drop down menu, select the App ID you want to use, then click Continue.
  7. Select the iOS Development certificate of the App ID you have chosen in the previous step, then click Continue.
  8. Select the iOS devices that you want to include in the Provisioning Profile, then click Continue. Make sure to select all the devices you want to use for your testing.
  9. Input a name for this provisioning profile (e.g. Firebase Sample App Development Profile), then click Generate.
  10. Click Download to save the Provisioning Profile to your Mac.
  11. Double-click the Provisioning Profile file to install it.
  1. 导航到 Apple Developer Member Center 并登录。
  2. 导航到证书、标识符和配置文件。
  3. 在左上角的下拉菜单中,选择 iOS、tvOS、watchOS(如果尚未选择),然后导航到 Provisioning Profiles > All。
  4. 单击 + 按钮以创建新的配置文件。
  5. 选择 iOS App Development 作为配置文件类型,然后单击继续。
  6. 在下拉菜单中,选择您要使用的 App ID,然后单击继续。
  7. 选择您在上一步中选择的 App ID 的 iOS 开发证书,然后单击继续。
  8. 选择要包含在配置文件中的 iOS 设备,然后单击继续。确保选择要用于测试的所有设备。
  9. 输入此配置文件的名称(例如 Firebase 示例应用程序开发配置文件),然后单击生成。
  10. 单击下载以将配置文件保存到您的 Mac。
  11. 双击 Provisioning Profile 文件进行安装。

2. Activate Push Notification capabilities

2. 激活推送通知功能

  1. Go to project editor, from official manualenter image description here
  2. In capabilities section, Activate Push Notification enter image description here
  1. 官方手册转到项目编辑器在此处输入图片说明
  2. 在功能部分,激活推送通知 在此处输入图片说明

回答by Venky Chittala

I had the same problem using iOS 8.0 and above versions; I didn't get the device token and was giving error: "no valid 'aps-environment' entitlement string found for application"

我在使用 iOS 8.0 及以上版本时遇到了同样的问题;我没有得到设备令牌并给出错误:“没有为应用程序找到有效的‘aps-environment’权利字符串”

I fixed it by using below steps

我使用以下步骤修复了它

  • I have created new provisioning profile for the app id
  • added it into xcode
  • project Go to Xcode "Preferences"
  • Go to "Accounts" tab Select my Apple ID and click "View Details"
  • select your provisioning profile
  • Click on the arrow on the bottom left corner to refresh
  • Click "Done"
  • 我为应用程序 ID 创建了新的配置文件
  • 将它添加到 xcode
  • 项目转到Xcode“首选项”
  • 转到“帐户”选项卡选择我的 Apple ID 并单击“查看详细信息”
  • 选择您的配置文件
  • 点击左下角的箭头刷新
  • 点击“完成”

and now run the project definitely it'll work.

现在运行该项目肯定会起作用。

回答by FrankByte.com

For some reason Wei's solution was not working for me. When clicking the Fix entitlements, Xcode generated two files and it still did not function, indeed the generated entitlements files were empty.

出于某种原因,魏的解决方案对我不起作用。当点击 Fix entitlements 时,Xcode 生成了两个文件,它仍然不起作用,确实生成的权利文件是空的。

This was caused (apparently) by the PRODUCT_NAME of the project being rather long and including spaces and "?" and "?" letters. After changing it to a short version with english-only letters the fix by Wei worked correctly.

这(显然)是由项目的 PRODUCT_NAME 相当长并且包含空格和“?”引起的。和 ”?” 字母。将其更改为仅包含英文字母的简短版本后,Wei 的修复工作正常。

回答by Alex Ryltsov

It took me a while to figure out what causing no valid aps-environment entitlement error. The problem was that there were two .entitlements files in XCode project. One is platform/ios//.entitlements and another one is platform/ios//Resources/.entitlements and the appropriate entitlements is present in the former file only while XCode is configured to use the latter. I updated the latter file manually and everything started to work. Another option to fix this is to change which .entitlements is used by XCode. This can be done in Build Settings --> Signing --> Code Signing Entitlements config param.

我花了一段时间才弄清楚是什么导致没有有效的 aps-environment 权利错误。问题是 XCode 项目中有两个 .entitlements 文件。一个是platform/ios//.entitlements,另一个是platform/ios//Resources/.entitlements,只有当XCode 配置为使用后者时,前一个文件中才会出现相应的权利。我手动更新了后一个文件,一切都开始工作了。解决此问题的另一个选择是更改 XCode 使用的 .entitlements。这可以在 Build Settings --> Signing --> Code Signing Entitlements 配置参数中完成。

I'm not sure why there are two .entitlements files in XCode. Could it be that the cordova push plugin created the second one (i'm developing a hybrid cordova mobile app)? And what is the correct location for the .entitlements file?

我不确定为什么 XCode 中有两个 .entitlements 文件。难道是cordova push插件创建了第二个(我正在开发一个混合cordova移动应用程序)?.entitlements 文件的正确位置是什么?

回答by Desen GUO

I experienced this issue and resolved it with the first solution.

我遇到了这个问题并用第一个解决方案解决了它。

However, I have failed once because I had two apple accounts logged-in. After removed one, everything became working.

但是,我失败了一次,因为我登录了两个苹果帐户。删除一个后,一切都开始工作了。