最近在做一個項目的更新上架刚照,上傳到蘋果審核刑巧,因為啟動時候會崩潰導(dǎo)致被拒。我在本地進(jìn)行測試時无畔,都沒有問題啊楚。(事后發(fā)現(xiàn)我只有用iOS 10一下版本進(jìn)行測試,沒有進(jìn)行測試iOS 10真機(jī))前后左右折騰了一段時間浑彰,期間也搭建過ipv6環(huán)境進(jìn)行測試恭理,最后發(fā)現(xiàn)是在iOS 10系統(tǒng)的權(quán)限出現(xiàn)問題。
首先郭变,先看一下蘋果發(fā)過來的crash log
???完全看不懂颜价,都是一些內(nèi)存地址,我試過使用symbolicatecrash進(jìn)行解析诉濒,仍然是一些內(nèi)存地址周伦,完全定位不到具體的崩潰函數(shù)。
我仔細(xì)看了蘋果審核發(fā)過來的信息
Your app crashes on iPad running iOS 10.2.1 when we:
launch the app
Next Steps
Please review your app on iPad to ensure that it runs without crashing. Also, please follow the steps to reproduce the issue when running your app on iPad configured for real world use.
For new apps, uninstall all previous versions of your app from a device, then install and follow the steps to reproduce. For updates, install the new version as an update to the previous version, then install and follow the steps to reproduce.
意思是說未荒,我的應(yīng)用在運(yùn)行在ipad(iOS 10.2.1)上面专挪,啟動時候會發(fā)生閃退的情況。下面說了片排,解決的建議寨腔。。
剛開始我以為可能是ipad的布局問題導(dǎo)致的閃退率寡,特定拿了ipad的模擬器(沒有ipad)進(jìn)行測試迫卢,沒有問題,之后勇劣,更新了afn靖避,搭建ipv6環(huán)境進(jìn)行測試潭枣,都是沒有問題的。我才意識到幻捏,我的應(yīng)用還沒有在iOS 10.2.1上面進(jìn)行測試盆犁。于是,我更新了iphone系統(tǒng)篡九,進(jìn)行測試谐岁,居然崩潰了!報了以下錯誤:
This app has crashed because it attempted to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NSMicrophoneUsageDescription key with a string value explaining to the user how the app uses this data.
原來是iOS 10系統(tǒng)的權(quán)限問題導(dǎo)致的崩潰榛臼,汗??伊佃,之后的解決方法就很簡單了。只需要在info.plist文件中沛善,添加即可航揉。
這里也提供一下其他的權(quán)限key,如果你在應(yīng)用中有使用其中的功能金刁,不要忘記添加這些key哦帅涂。
<key>NSCameraUsageDescription</key>
<string>cameraDesciption</string>
<key>NSContactsUsageDescription</key>
<string>contactsDesciption</string>
<key>NSMicrophoneUsageDescription</key>
<string>microphoneDesciption</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>LibraryUsageDescription</string>