您的位置:首页 > 移动开发 > IOS开发

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

2017-10-19 21:42 691 查看


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 nameApp安装后显示的名称
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>


以下为常用权限对照表

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: