iOS开发中info.plist相关配置(附iOS10权限设置)

1.定位为题:

调用定位时在target里设置两个属性:
NSLocationAlwaysUsageDescription 
NSLocationWhenInUseUsageDescription

2. 网络请求:

Xcode升级后不支持http访问的解决办法:在Info.plist中添加NSAppTransportSecurity类型Dictionary。
在NSAppTransportSecurity下添加NSAllowsArbitraryLoads类型Boolean,值设为YES

3. 设置应用名称(Bundle display name):

<key>CFBundleDisplayName</key>
<string>APP名称</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 设置程序默认支持的方向

另外iOS 10 权限设置如下(列举几个):

(需要用到的权限做key,去掉NS首字母小写做value)
  • 相机:
 <key>NSCameraUsageDescription</key> 
 <string>cameraDesciption</string>

</br>

  • 相册:
<key>NSPhotoLibraryUsageDescription</key> 
<string>photoLibraryDesciption</string>

</br>

  • 通信录:
<key>NSContactsUsageDescription</key> 
<string>contactsDesciption</string>

</br>

  • 麦克风:
<key>NSMicrophoneUsageDescription</key> 
<string>microphoneDesciption</string>

</br>


以下为常用权限对照表

0.png

转载于http://www.cnblogs.com/blogfan/p/5848645.html

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容