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 ...
随机推荐
- 排序算法lowb三人组-插入排序
def insert_sort(li): for i in range(1, len(li)): # i表示摸到的牌的下标 tmp = li[i] # 摸到的牌 j = i - 1 while j & ...
- SPOJ2666 QTREE4
我是萌萌的传送门 我是另一个萌萌的传送门 一道树分治……简直恶心死了……我在调代码的时候只想说:我*************************************************…… ...
- cf1043F. Make It One(dp 容斥原理)
题意 题目链接 给出\(n\)个数,问最少选几个数,使他们的\(gcd = 1\) Sol 好神仙啊qwq. 首先,如果答案存在,那么最多为\(7\)(因为前\(7\)个质数乘起来\(>= 3e ...
- 定期重启SSRS 服务
SSRS 在执行了一段时间之后会变得非常卡,遇到好几次内存暴涨,CPU100%的情况. 但是在查询了一通以后发现,这个时间没有人在运行报告,不知道是哪里有问题,没有回收... 所以决定定期在晚上没有不 ...
- 【Web crawler】simulated DFS web crawler
Finish crawl web learned from udacity 提示:在某些时候,你必须在page上调用get_page.这似乎违反直觉,但是我们用 page 这个词时,指的网页的网址 ( ...
- 【JAVA语法】04Java-多态性
多态性 instanceof 关键字 接口的应用 一.多态性 1.多态性的体现: 方法的重载和重写 对象的多态性 2.对象的多态性: 向上转型: 程序会自动完成 父类 父类对象 = 子类实例 向下转型 ...
- idea 安装findBugs 和 checkStyle
1.fiindBugs是一款 静态分析工具,检查程序潜在bug,在bug报告中快速定位到问题的代码上.在idea下面安装很简单可以参考 http://zhongmin2012.iteye.com/bl ...
- dubbo学习总结三 消费端
消费端跟服务端类似 注意点是dubbo:reference 和服务端的dubbo:service做区分 消费端主要是处理发送过来的请求
- 3.获取git仓库
有两种取得 Git 项目仓库的方法. 第一种是在现有项目或目录下导入所有文件到 Git 中: 第二种是从一个服务器克隆一个现有的 Git 仓库. 在现有目录中初始化仓库 如果你打算使用 Git 来对现 ...
- C#调用Excel VBA宏[转载]
原文地址:https://www.cnblogs.com/heekui/archive/2008/03/30/1129355.html 近日的一系列工作是做网站的营运维护,因此做了大量的支持工具.有E ...