提交App Store或者Export導(dǎo)出ipa包的時(shí)候,報(bào)錯(cuò),主要信息及截圖如下,附解決方案。
None of the valid provisioning profiles allowed the specified entitlements:beta-reports-active,aps-environment

原因:用xcode8和xcode7編譯了同一份代碼,用xcode8編譯以后就會(huì)多一些配置文件,最明顯的就是多了一個(gè)MyApp.entitlements文件
解決方案:在打包的時(shí)候需要將如下圖箭頭所指的值修改為production.

About Entitlements
entitlements###
n.授權(quán),有資格( entitlement的名詞復(fù)數(shù) ); 有權(quán)得到的東西;
N. authorized, qualified (entitlement plural noun); the right to get something;
在此,我們把它統(tǒng)稱(chēng)為“授權(quán)文件”以免造成混淆。
以下是蘋(píng)果開(kāi)發(fā)文檔對(duì)此的介紹,以及個(gè)人對(duì)其做出的一些理解。
Set entitlement values in order to enable iCloud, push notifications, Apple Pay, and App Sandbox. Each entitlement has a default value, which in most cases disables the capability associated with the entitlement. When you set an entitlement, you are overriding the default by providing an appropriate key-value pair.
設(shè)置“授權(quán)文件”的值是為了啟用iCloud,蘋(píng)果推送通知,支付,和應(yīng)用程序沙盒。每個(gè)權(quán)利都有一個(gè)默認(rèn)值,在大多數(shù)情況下,禁用與權(quán)利相關(guān)的能力。設(shè)置權(quán)限時(shí),通過(guò)提供適當(dāng)?shù)逆I值對(duì)來(lái)重寫(xiě)默認(rèn)值。
推送功能在項(xiàng)目中使用率高,問(wèn)題也大都再此,于是乎,果斷拿推送說(shuō)事兒。
Xcode 8 中,打開(kāi)推送開(kāi)關(guān),就會(huì)自動(dòng)生成此文件,而且提交的時(shí)候也必須有這個(gè)。
下面看一下

You set a value for the push notification entitlement by way of your development and distribution provisioning profiles, as described in Local and Remote Notification Programming Guide.
the provisioning portal assigns a value of development or production to the key.
對(duì)于iOS 來(lái)說(shuō),設(shè)置這個(gè)"授權(quán)文件"的值取決于你 provisioning profiles的類(lèi)型,那么Value只有兩個(gè) development or production .
結(jié)論:
當(dāng)我們遇到這個(gè)問(wèn)題的時(shí)候解決順序,
- 1.先查看"授權(quán)文件"即entitilements 的Value是否與配置文件匹配
- 2.如果如果匹配,接下來(lái)就檢查配置文件的問(wèn)題等。