Iphone can';无法从资源中读取plist
在我的资源目录中有一个名为lsf.plist的文件 我想加载这个文件(字典),但我总是得到null作为文件的内容。我正在使用以下代码。我已验证该文件在生成后是否在应用程序中Iphone can';无法从资源中读取plist,iphone,plist,Iphone,Plist,在我的资源目录中有一个名为lsf.plist的文件 我想加载这个文件(字典),但我总是得到null作为文件的内容。我正在使用以下代码。我已验证该文件在生成后是否在应用程序中 self.path = [[NSBundle mainBundle] pathForResource:@"lsf" ofType:@"plist"]; NSLog(self.path); self.lsf = [NSMutableArray arrayWithContentsOfFile:path]; NSLog(@"%@
self.path = [[NSBundle mainBundle] pathForResource:@"lsf" ofType:@"plist"];
NSLog(self.path);
self.lsf = [NSMutableArray arrayWithContentsOfFile:path];
NSLog(@"%@",lsf);
第一个日志输出显示路径,第二个日志输出为null。。。。
如果你能帮我解决这个问题就太好了
比尔,
martin是plist数组或字典的根吗? 你也不需要使用self。 以下是我的一个项目的例子:
NSString* path = [[NSBundle mainBundle] pathForResource:@"property" ofType:@"plist"];
NSDictionary *newDict = [NSDictionary dictionaryWithContentsOfFile:path];
plist数组或字典的根是什么? 你也不需要使用self。 以下是我的一个项目的例子:
NSString* path = [[NSBundle mainBundle] pathForResource:@"property" ofType:@"plist"];
NSDictionary *newDict = [NSDictionary dictionaryWithContentsOfFile:path];
“自我路径”和“路径”一样吗?是的,它是。。。只是复制粘贴失败“self.path”与“path”相同吗?是的,它是。。。只是复制粘贴失败