通过宏定义从plist中读取配置
作者:
kivinSun | 来源:发表于
2017-03-11 22:56 被阅读57次#define isConfigPathExist [[NSFileManager defaultManager] fileExistsAtPath:[[[NSBundle mainBundle] bundlePath] stringByAppendingPathComponent:@"Config.plist"] isDirectory:NO]
#define configPath [NSDictionary dictionaryWithContentsOfFile:[[[NSBundle mainBundle] bundlePath] stringByAppendingPathComponent:@"Config.plist"]]
#define DEBUG_INNER isConfigPathExist?([[configPath objectForKey:@"DEBUG"] boolValue]):NO
#define DOCTORID isConfigPathExist? ([configPath objectForKey:@"DOCTORID"]) :nil```
通过上面DEBUG_INNER这个宏定义,就可以做到在Config.plist中的一个DEBUG值来决定是否是调试状态。
通过上面DOCTORID这个宏定义,读取Config.plist中的字符串DOCTORID
本文标题:通过宏定义从plist中读取配置
本文链接:https://www.haomeiwen.com/subject/zjnzgttx.html
网友评论