下面是一些iOS項目中常用的plist文件的相關設置:
1.定位為題:
調用定位時在target里設置兩個屬性:NSLocationAlwaysUsageDescription NSLocationWhenInUseUsageDescription
2. 網絡請求:
Xcode升級后不支持http訪問的解決辦法:在Info.plist中添加NSAppTransportSecurity類型Dictionary。
在NSAppTransportSecurity下添加NSAllowsArbitraryLoads類型Boolean,值設為YES
3. 設置應用名稱(Bundle display name):
<key>CFBundleDisplayName</key>
<string>應用程序名稱</string>
4.設置應用程序版本號(Bundle version):
每次部署應用程序的一個新版本時,將會增加這個編號,用於標識不同的版本。
<key>CFBundleVersion</key>
<string>1.0</string>
5.設置應用程序是否支持后台運行(Application does not run in background)
通過UIApplicationExitsOnSuspend可以設置iOS的應用程序進入到掛起狀態下是否立即退出,設置為YES表示不支持后台運行退出到后台立即退出,設置為NO表示 支持后台運行。
(1)設置支持后台運行
<key>UIApplicationExitsOnSuspend</key>
<false/>
(2)設置不支持后台運行
<key>UIApplicationExitsOnSuspend</key>
<true/>
6. info.plist的幾個常見屬性:
Localization native development region : 與本地化設置有關,為默認的開發語言
Executable file:程序安裝包的名稱
Bundle identifier:軟件唯一的標識,是根據公司的標識與項目名稱自動生成的,在上傳和測試的時候會用到
InfoDictionary version:版本信息
Bundle name:App安裝后顯示的名稱
Bundle OS Type code:用來標識軟件包類型
Bundle versions string, short:發布的版本字符串
Bundle creator OS Type code:創建者的標識
Bundle version:應用程序版本號
Application requires iPhone environment:用於指示程序包是否只能運行在iPhone OS 系統上,默認為YES
Launch screen interface file base name:歡迎界面的文件名稱
Main storyboard file base name:默認情況下程序的主入口
Supported interface orientations:設置程序默認支持的方向
