iOSBundle打包UIRequiredDeviceCapabilities引起的bug

????今天測(cè)試給我反饋了一個(gè)bug,在iOS10的iPhone5手機(jī)出現(xiàn)了白屏的現(xiàn)象,先說下我們的項(xiàng)目結(jié)構(gòu)。我們的項(xiàng)目是一個(gè)ionic工程,在里面有一個(gè)原生的模塊,當(dāng)用戶進(jìn)入原生模塊之后,白屏。剛開始是百思不得其解,后來想是不是iOS13的問題,因?yàn)橹霸趇nfo.plist里新加了UIUserInterfaceStyle字段,剛開始在這個(gè)方向去找問題,怎么也找不到,后來換了一種思路,白屏說明view沒有加載出來,而view是由xib創(chuàng)建的,是不是bundle出了問題?最后通過比對(duì)bundle的info.plist文件,最終找到了原因,bundle的plist文件里多了一個(gè)UIRequiredDeviceCapabilities字段 o(╥﹏╥)o。
????我們來看下這個(gè)字段是什么意思

A key that tells iTunes and the App Store know which device-related features an application requires in order to run. iTunes and the mobile App Store use this list to prevent customers from installing applications on a device that does not support the listed capabilities.

The value of this key is either an array or a dictionary. If you use an array, the presence of a given key indicates the corresponding feature is required. If you use a dictionary, you must specify a Boolean value for each key indicating whether the feature is required. In both cases, not including a key indicates that the feature is not required.

For a list of keys to include in the dictionary, see Information Property List Key Reference. This key is supported in iOS 3.0 and later.

????大概意思是通過添加這個(gè)字段,可以對(duì)運(yùn)行這個(gè)app加一些限制,比如我添加了arm64,這個(gè)app就僅能在arm64架構(gòu)的手機(jī)上運(yùn)行,所有armv7的手機(jī)就不能運(yùn)行。


UIRequiredDeviceCapabilities的一些字段名.png

還有一些其他的字段,感興趣的可以在下面的引用文件找到。

????再來說下我的bug是怎么造成的,在我打包bundle的時(shí)候,是在DEBUG模式下打的,而在Buidl Setting-Build Active Architecture Onli字段下,DEBUG為YES,而且當(dāng)前的設(shè)備選擇是一臺(tái)iPhone 6的手機(jī),所以就導(dǎo)致在編譯的過程中自動(dòng)添加了UIRequiredDeviceCapabilities,這個(gè)字段,且當(dāng)前的限制為arm64(iPhone 6是arm64的手機(jī)),至此導(dǎo)致了這個(gè)bug。

033B2FC4-EEAA-402B-81F5-67D06AD7B8AE.png

生成的UIRequiredDeviceCapabilities字段.png

????不過還有一個(gè)很奇怪的是,添加了這個(gè)字段之后不管是xcode打包還是通過下發(fā)蒲公英的app,運(yùn)行在iPhone 5的手機(jī)都是沒有問題的,只有下載AppStore上的app才是有問題的。

Bundle Programming Guide

Information Property List Key Reference

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容