码迷,mamicode.com
首页 > 移动开发 > 详细

app info.plist

时间:2016-09-07 12:45:17      阅读:170      评论:0      收藏:0      [点我收藏+]

标签:

1.获取app的info.plist详细信息
版本号:Bundle version
 NSString *version = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"];
应用标识:Bundle identifier
NSString *bundleId = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleIdentifier"];
应用名称:Bundle display name
NSString *appName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"];
Bundle name
NSString *appName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleName"];
 
2.应用程序语言本地化
app本地化宏
#define XLocalizedString(key, comment)        [[NSBundle mainBundle] localizedStringForKey:(key) value:@"" table:nil]
中英文两个Localizable.strings文件中键值对,例如
"none" = "确定";
"none" = "none";
宏的用法:(返回NSString *)
localizedString("none", "这是注释")
 
3.获取包内文件路径和文件
获取app包路径
NSString *path = [[NSBundle mainBundle] bundlePath];
app资源目录路径
NSString *resPath = [[NSBundle mainBundle] resourcePath];
 
获取资源目录下a.bundle
NSString* path = [resPath stringByAppendingPathComponent:@"a.bundle"];
NSBundle *bundle = [NSBundle bundleWithPath:path];
 
获取app包的readme.txt文件路径
NSString *path = [[NSBundle mainBundle] pathForResource:@"readme" ofType:@"txt"];

app info.plist

标签:

原文地址:http://www.cnblogs.com/Toney-c/p/5848574.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!