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>
  • 相册:
    <key>NSPhotoLibraryUsageDescription</key> 
    <string>photoLibraryDesciption</string>
  • 通信录:
    <key>NSContactsUsageDescription</key> 
    <string>contactsDesciption</string>
  • 麦克风:
    <key>NSMicrophoneUsageDescription</key> 
    <string>microphoneDesciption</string>

以下为常用权限对照表
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值