iOS10之Expected App Behaviors,ios10behaviors
昨天上架到appStore的時候碰到個問題,構建好後上傳到itunesconnect的的包都用不了,
顯示錯誤為:此構建版本無效。
或者英文顯示為:ITC.apps.preReleaseBuild.errors.invalidBinary
由於和itunesconnect帳號綁定的郵箱暫時進不去,沒看到apple發到我們郵箱的通知資訊,所以只在度娘搜尋:有的說
是網路問題,有說是電腦問題,有說是icon問題,有說使用Application Loader上傳.....
但是試了都沒解決問題,然後就出現了這麼多個『此構建版本無效』
後面終於登入了郵箱,看打了apple那邊的團隊發過來的通知訊息,原來是這個原因:
......
This app attempts to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NSBluetoothPeripheralUsageDescription key with a string value explaining to the user how the app uses this data.Once these issues have been corrected, you can then redeliver the corrected binary.Regards,The App Store team
意思是app的設定檔info.plist少了一個app請求使用裝置藍芽的請求配置:NSBluetoothPeripheralUsageDescription
然後加上後,再次打包上傳就可以使用了!
查了下資料,apple從iOS10之後,Expected App Behaviors(預期應用行為),對於使用者的隱私更加重視,如果需要訪問使用者手機的相機、多媒體、藍芽、通訊錄、位置、健康、運動...等等,必須詢問使用者徵得使用者授權才可以使用。
官方說明連結:
https://developer.apple.com/library/content/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/ExpectedAppBehaviors/ExpectedAppBehaviors.html
在項目工程設定檔info.plist添加時會自動提示的,如下:
查看info.plist的source code,展開如下:
<key>NSBluetoothPeripheralUsageDescription</key> <string>是否允許此App訪問您的藍芽</string> <key>NSCalendarsUsageDescription</key> <string>是否允許此App訪問您的日曆</string> <key>NSCameraUsageDescription</key> <string>是否允許此App使用您的相機</string> <key>NSContactsUsageDescription</key> <string>是否允許此App訪問您的通訊錄</string> <key>NSHealthShareUsageDescription</key> <string>是否允許此App訪問您的健康分享</string> <key>NSHealthUpdateUsageDescription</key> <string>是否允許此App訪問您的健康更新</string> <key>NSHomeKitUsageDescription</key> <string>是否允許此App訪問您的HomeKit</string> <key>NSLocationAlwaysUsageDescription</key> <string>我們需要通過您的地理位置資訊擷取您周邊的相關資料</string> <key>NSLocationWhenInUseUsageDescription</key> <string>您的位置資訊將用於地圖上顯示您的位置,並發送給連絡人</string> <key>NSMicrophoneUsageDescription</key> <string>是否允許此App使用您的麥克風</string> <key>NSMotionUsageDescription</key> <string>App需要您的同意,才能訪問運動與健身</string> <key>kTCCServiceMediaLibrary</key> <string>是否允許此App訪問您的音樂</string> <key>NSPhotoLibraryUsageDescription</key> <string>是否允許此App訪問您的媒體資料庫</string> <key>NSRemindersUsageDescription</key> <string>是否允許此App訪問您的提醒事項</string> <key>NSSiriUsageDescription</key> <string>是否允許此App訪問您的Siri</string> <key>NSSpeechRecognitionUsageDescription</key> <string>是否允許此App使用您的語音辨識</string> <key>NSVideoSubscriberAccountUsageDescription</key> <string>是否允許此App訪問您的tv供應商賬戶</string>
原文連結:http://www.cnblogs.com/tandaxia/p/6207236.html