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 ...
随机推荐
- ES6之class 中 constructor 方法 和 super 的作用
首先,ES6 的 class 属于一种“语法糖”,所以只是写法更加优雅,更加像面对对象的编程,其思想和 ES5 是一致的. function Point(x, y) { this.x = x; thi ...
- sass语法一(变量篇)
文件后缀名 sass有两种后缀名的文件:一种后缀名为sass,不使用大括号和分号:另一种是我们这里使用的scss文件,这种和我们平时使用的css文件格式差不多,使用大括号和分号. //后缀名为sass ...
- ArcGIS DataStore手册——管理篇
第二章:ArcGIS DataStore管理维护 1.备份管理 备份的目的在于发生原始数据损坏或其他突发情况时,可避免数据丢失,并可快速的使用备份数据来恢复,以保证服务仍可使用. 单机模式下,可使用D ...
- 回溯法最优装载问题(java)
1.问题描述: 有一批共有 n 个集装箱要装上两艘载重量分别为 c1 和 c2 的轮船,其中集装箱 i 的重量为 w[i], 且重量之和小于(c1 + c2).装载问题要求确定是否存在一个合 ...
- 使用intellij idea搭建MAVEN+SSM(Spring+SpringMVC+MyBatis)框架
基本概念 使用SSM(Spring,SpringMVC和Mybatis) 1.1.Spring Spring是一个开源框架,Spring是于2003 年兴起的一个轻量级的Java 开发框架,由Rod ...
- winform 写入和读取TXT文件
C# winform写入和读取TXT文件 string str; str=this.textBox1.Text; StreamWriter sw = new StreamWriter(Applicat ...
- Azure DocumentDB 正式发布
DocumentDB 简介 一种 NoSQL JSON 数据库 Azure DocumentDB 提供完全托管的 NoSQL 数据库服务,高度可用,自动缩放,开发简易,可以加速并预测性能.它适合诸如 ...
- Oracle sql trace用法
sql_trace是oracle提供的一个非常好的跟踪工具,主要用来检查数据库的异常情况,通过跟踪数据库的活动,找到有问题的语句. 一.概述: SQL_TRACE是Oracle的一个非常强大的工 ...
- 轻松bypass360网站卫士WAFSQL注入防护
随便网上找了一个网站,只是测试一下,没有干非法的事情! code 区域 http://www.py-guanyun.com/CompHonorBig.asp?id=49 code 区域 http:// ...
- BZOJ2438:[中山市选2011]杀人游戏(强连通分量)
Description 一位冷血的杀手潜入 Na-wiat,并假装成平民.警察希望能在 N 个人里面,查出谁是杀手.警察能够对每一个人 进行查证,假如查证的对象是平民,他会告诉警察,他认识的人, 谁是 ...