解决pathForResource返回nil / 无法读取plist文件问题

问题:

NSBundle *bundle = [NSBundle mainBundle]; //取得mainBundle
NSString *pathOfPlist = [bundle pathForResource:@"PlistTest-Info" ofType:@"plist"]; //取得文件路径

解决方案:

单击项目-》Build phases-》找到CopyBundleResources 然后将PlistTest-Info.plist文件添加进来即可。

参考:http://www.it165.net/os/html/201301/4327.html

http://www.devdiv.com/forum.php?mod=viewthread&tid=32080

posted @ 2014-03-28 08:12  ygm900  阅读(2597)  评论(0编辑  收藏  举报