My Mac OS X app has (as all apps do) a plist file in its bundle which defines the bundle version, bundle name, etc.
I want to read this plist at runtime but I don't know how to do this! I even don't know where this file is located and cannot find it !!
Please, note that I am NOT looking for the plist file created in /Library/Preferences
which is linked to the NSUserDefaults
(this question is raised in other posts on stackoverflow and I perfectly know how to read this file).
I tried the following code (AG-Info.plist being the name of the plist in my bundle):
NSString *path = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"AG-info.plist"];
NSDictionary *plistDictionary = [[NSDictionary dictionaryWithContentsOfFile:path] retain];
But it doesn't work ! (it works in iOS apps)
Somebody knows how to find my bundle plist?
Simply use:
NSDictionary *dict = [[NSBundle mainBundle] infoDictionary];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With