返回字典我有一個方法:- [NSDictionary dictionaryWithContentsOfFile]在iPad上返回零;在模擬器
#define ROOT_ASSETS_PATH @"/assets/"
...
-(NSMutableDictionary*) getContentsOfPlist{
NSString *pageContentPlistPath = [[[[NSBundle mainBundle] bundlePath] stringByAppendingPathComponent: ROOT_ASSETS_PATH] stringByAppendingPathComponent:@"content.plist"];
NSMutableDictionary *mDictionary = [NSMutableDictionary dictionaryWithContentsOfFile:pageContentPlistPath];
return mDicitonary;
}
在模擬器上。這會返回一個字典。在iPad上,它返回零。確保分機箱與通話中的相匹配。
任何想法?
使用'[[NSBundle mainBundle] pathForResource:@「contents」ofType:@「plist]'。並且'contents.plist'可能被保留,您應該命名爲其他名稱 – Kevin
只需使用該示例的名稱。在我的應用程序中有一個更加獨特的名字 –
上的設備名稱區分大小寫,在模擬器上沒有,請仔細檢查, – Ultrakorne