سؤال

I am currently porting a project to MacOS, and in the Windows version we use VerQueryLang(...), which is part of winapi, to determine some file version information for the window title.

Is there an equivalent function on MacOS?

هل كانت مفيدة؟

المحلول

Yes, it's built into the app's bundle:

NSBundle *mainBundle = [NSBundle mainBundle];
NSString *version = [mainBundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"];
NSString *build = [mainBundle objectForInfoDictionaryKey:@"CFBundleVersion"];

Reference.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top