How can I access version of the app within Settings.bundle like it is in info.plist?

72 Views Asked by At

Some of the variables are accesses from within Info.plist file like $(VARIABLE):

enter image description here

Is it possible to do the same in Settings.bundle?

I need to display there my current ios app version:

enter image description here

1

There are 1 best solutions below

0
brianLikeApple On

You cannot dynamically change the Settings.bundle. Settings.bundle always use static plist.

But you can change it using NSUserDefaults

enter image description here

//Set app version
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[defaults setValue:[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"] forKey:@"appVersion"];
[defaults synchronize];

You can put above code to:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions