내 프로젝트에서 plist 파일의 경로를 얻으려면이 함수를 사용하고 있습니다 :내 프로젝트에서 plist 파일의 경로를 가져올 수없는 이유는 무엇입니까?
+ (NSString *) appDataPath{
NSLog(@"in appDataPath");
NSString *appDPath = nil;
// Get the main bundle for the app.
NSBundle* mainBundle = [NSBundle mainBundle];
if (mainBundle != nil) {
NSLog(@"in appDataPath mainbundle");
appDPath = [mainBundle pathForResource:@"MyAppSettings" ofType:@"plist"];
NSLog(@"appDataPath: %@", appDPath);
}
return appDPath;
}
경우 (mainBundle! = nil) 있지만 appDPath null입니다. 동일한 기능이 다른 프로젝트에서 작동합니다. 왜 여기서 일하지 않는거야? 프로젝트에서 plist 파일의 경로를 가져 오는 다른 방법이 있습니까? 미리 감사드립니다.
실제로 프로젝트의 리소스에'MyAppSettings.plist' 파일이 있습니까? – DarkDust
예. 내 프로젝트의 리소스에는 MyAppSettings.plist가 있습니다. – Piscean