2014-09-04 5 views

답변

1

이 작업을 수행 할 수있는 몇 가지 방법을있다 - 나는 보통 CFBundleversion 이외에 NSBundle을 사용하여 최단 경로를 가지고 :

최고의
NSBundle *appBundle = [NSBundle bundleWithPath:appPath]; 
NSString *bundleVersion = [appBundle objectForInfoDictionaryKey:@"CFBundleVersion"]; 
1

응용 프로그램의 전체 경로를 찾으면 Contents/Info.plist 파일을 읽고 CFBundleShortVersionString 값을 볼 수 있습니다. 이 같은

뭔가 :

NSString *appPath = [NSWorkspace fullPathForApplication:appName]; 
NSString *plistPath = [appPath stringByAppendingPathComponent:@"Contents/Info.plist"]; 
NSDictionary *plist = [NSDictionary dictionaryWithContentsOfFile:plistPath]; 
NSString *version = plist[@"CFBundleShortVersionString"]; 
+0

아주 좋은 답변, 좀 더있어 내가 원하는 것보다. – Ping