iOS读取info.plist中的值
在app运行的时候,需要读取info.plist中的信息,用以下代码可获取整个info.plist的信息
[[NSBundle mainBundle] infoDictionary]
以下为根据 key 值去取 URLTypes 里面对应的值:
+ (NSString *)URLSchemesForkey:(NSString *)key { NSDictionary *dict = [[NSBundle mainBundle] infoDictionary];
NSArray *urlTypes = dict[@"CFBundleURLTypes"];
NSString *urlSchemes = nil;
for (NSDictionary *scheme in urlTypes) {
NSString *schemeKey = scheme[@"CFBundleURLName"];
if ([schemeKey isEqualToString:key]) {
urlSchemes = scheme[@"CFBundleURLSchemes"][];
break;
}
}
return urlSchemes;
}
info.plist所有的信息,示例如下:
{
"" = "";
BuildMachineOSBuild = 16G1114;
CFBundleDevelopmentRegion = "zh_CN";
CFBundleDisplayName = "xxxx";
CFBundleExecutable = Ronghemt;
CFBundleIcons = {
CFBundlePrimaryIcon = {
CFBundleIconFiles = (
AppIcon20x20,
AppIcon29x29,
AppIcon40x40,
AppIcon60x60
);
CFBundleIconName = AppIcon;
};
};
CFBundleIdentifier = "xxxx";
CFBundleInfoDictionaryVersion = "6.0";
CFBundleName = xxx;
CFBundleNumericVersion = 0;
CFBundlePackageType = APPL;
CFBundleShortVersionString = "2.xxx";
CFBundleSupportedPlatforms = (
iPhoneOS
);
CFBundleURLTypes = (
{
CFBundleTypeRole = Editor;
CFBundleURLName = WX;
CFBundleURLSchemes = (
xxx
);
},
{
CFBundleTypeRole = Editor;
CFBundleURLName = xxx;
CFBundleURLSchemes = (
"xxx"
);
},
{
CFBundleTypeRole = Editor;
CFBundleURLName = tencent;
CFBundleURLSchemes = (
xxx
);
},
{
CFBundleTypeRole = Editor;
CFBundleURLName = QQ;
CFBundleURLSchemes = (
xxx
);
},
{
CFBundleTypeRole = Editor;
CFBundleURLName = xxxx;
CFBundleURLSchemes = (
xxxxxx
);
}
);
CFBundleVersion = "180119.001";
DTCompiler = "com.apple.compilers.llvm.clang.1_0";
DTPlatformBuild = 15C107;
DTPlatformName = iphoneos;
DTPlatformVersion = "11.2";
DTSDKBuild = 15C107;
DTSDKName = "iphoneos11.2";
DTXcode = 0920;
DTXcodeBuild = 9C40b;
LSApplicationQueriesSchemes = (
wechat,
weixin,
sinaweibohd,
sinaweibo,
sinaweibosso,
weibosdk,
"weibosdk2.5",
mqqapi,
mqq
);
LSRequiresIPhoneOS = 1;
MinimumOSVersion = "8.0";
NSAppTransportSecurity = {
NSAllowsArbitraryLoads = 1;
NSAllowsArbitraryLoadsInWebContent = 1;
};
NSCameraUsageDescription = "\U9700\U8981\U8bbf\U95ee\U60a8\U7684\U76f8\U673a\U8fdb\U884c\U62cd\U6444";
NSPhotoLibraryUsageDescription = "\U9700\U8981\U8bbf\U95ee\U60a8\U7684\U76f8\U518c\U83b7\U53d6\U56fe\U7247";
UIDeviceFamily = (
1
);
UILaunchImages = (
{
UILaunchImageMinimumOSVersion = "8.0";
UILaunchImageName = "LaunchImage-800-Portrait-736h";
UILaunchImageOrientation = Portrait;
UILaunchImageSize = "{414, 736}";
},
{
UILaunchImageMinimumOSVersion = "8.0";
UILaunchImageName = "LaunchImage-800-667h";
UILaunchImageOrientation = Portrait;
UILaunchImageSize = "{375, 667}";
},
{
UILaunchImageMinimumOSVersion = "7.0";
UILaunchImageName = "LaunchImage-700";
UILaunchImageOrientation = Portrait;
UILaunchImageSize = "{320, 480}";
},
{
UILaunchImageMinimumOSVersion = "7.0";
UILaunchImageName = "LaunchImage-700-568h";
UILaunchImageOrientation = Portrait;
UILaunchImageSize = "{320, 568}";
}
);
UIRequiredDeviceCapabilities = (
arm64
);
UIStatusBarStyle = UIStatusBarStyleLightContent;
UISupportedInterfaceOrientations = (
UIInterfaceOrientationPortrait,
UIInterfaceOrientationLandscapeLeft,
UIInterfaceOrientationLandscapeRight
);
}
iOS读取info.plist中的值的更多相关文章
- Eclipse RCP 中创建自己定义首选项,并能读取首选项中的值
Eclipse RCP的插件中若想自定义首选项须要扩展扩展点: org.eclipse.core.runtime.preferences //该扩展点用于初始化首选项中的值 org.eclipse.u ...
- iOS项目Info.plist中关键字汇总
1. Application does not run in background (键名:UIApplicationExistsOnSuspend) 自从iOS4.0之后,当你在应用程序执行的时候按 ...
- 前后台读取Web.config中的值的方法
webconfig <configuration> <appSettings> <add key="Workflow_Url" value=" ...
- Spring中使用@Value读取porperties文件中的属性值方法总结及注意事项
本文为博主原创,转载请注明出处. 此前曾总结过使用工具类读取properties文件中的属性值,有兴趣的可以看一下. 如何快速获取properties中的配置属性值:https://www.cnblo ...
- 封装的方法--读取任何路径下的properties文件中的值
概述:我们在做项目时,经常需要从某个properties文件中读取properties文件中的值.现在我封装了一下方法,直接读取配置文件中的值. 代码如下所示: /** * Created by qi ...
- [原创]java WEB学习笔记59:Struts2学习之路---OGNL,值栈,读取对象栈中的对象的属性,读取 Context Map 里的对象的属性,调用字段和方法,数组,list,map
本博客的目的:①总结自己的学习过程,相当于学习笔记 ②将自己的经验分享给大家,相互学习,互相交流,不可商用 内容难免出现问题,欢迎指正,交流,探讨,可以留言,也可以通过以下方式联系. 本人互联网技术爱 ...
- ios 访问隐私信息 info.plist 中的字段
1.iOS10相册相机闪退bug: iOS10系统下调用系统相册,相机功能,遇到闪退的情况,描述如下: This app has crashed because it attempted to acc ...
- java中Properties类及读取properties中属性值
本文为博主原创,未经允许不得转载: 在项目的应用中,经常将一些配置放入properties文件中,在代码应用中读取properties文件,就需要专门的类Properties类,通过这个类可以进行读取 ...
- C#读取注册表中二进制类型的值(REG_BINARY)
如需要读取注册表中某个键的值, 例如读取DriverDesc对应的值,一般情况下为String类型,读取代码如下: RegistryKey driverKey = Registry.LocalMach ...
随机推荐
- css3之弹性盒模型初探(一)
什么是弹性盒模型? 弹性盒模型是指在父级改变大小的时候内部的自己元素也会相应的改变大小,即子集会按照父级的大小按比例自适应大小. 弹性盒模型的提出可以解决一些响应式布局的需求 如何使用弹性盒模型? ...
- ssh和scp详解
一.SSH客户端使用 使用ssh客户端远程登陆到指定的计算机: $ ssh {user}@{remote} -o IdentityFile=/home/id_rsa -o StrictHostKeyC ...
- Scrapy安装教程 pip 或 conda 两种安装方法.
cmd: pip -V 查看pip版本 pip install --upgrade pip 升级最高版本 https://sourceforge.net/projects/py ...
- base64的编码解码的一些坑
1. //编码 value = base64encode(utf16to8(src)) //解码 value = utf8to16(base64decode(src)) 这里:base64编码之前先转 ...
- MongoDB 创建集合
createCollection() 方法 MongoDB db.createCollection(name, options) 是用来创建集合. 语法: 基本的 createCollection() ...
- 08_zookeeper的客户端工具curator_watcher
[使用usingWatcher()] //两个usingWatcher的传入参数不同 public interface Watchable<T> { T watched(); T usin ...
- idea output 消失找不到
今天一不小心把idea的 debug的控制台output 搞丢了, 半天找不到,原来是在这里隐藏着 Restore layout
- AJAX原生JavaScript写法
GET方式 //创建XMLHttpRequest对象,为考虑兼容性问题,老版本的 Internet Explorer (IE5 和 IE6)使用 ActiveX 对象 var ajax = windo ...
- 什么是封装? ----------------php中"public"类似的访问修饰符分别有什么作用?----什么是抽象?抽象的关键字以及用法----- 什么是接口?接口的关键字以及用法-------------
什么是封装? ------------------------------------封装是php面向对象的其中一个特性,将多个可重复使用的函数封装到一个类里面.在使用时直接实例化该类的某一个方法,获 ...
- ANT table表格合并
1. 合并前提 后台返回数据必须是:相同重复的数据必须是连在一起的,这样前台才能通过rowspan方法合并表格数据.(这是前提,后台需要注意) 2.步骤 1.前台需要根据后台返回的数据内容, ...