Reputation: 477
Currently, I have a custom user defined build settings in which I set the DISPLAY_NAME.
Then, in the General tab of Build Settings, in the display name column, I fetch this value as $(DISPLAY_NAME) from my user defined build settings.
I want to instead read the Display Name and set the general build settings from my Info.plist file. How can I do this?
Upvotes: 1
Views: 1189
Reputation: 802
you can use the following code.
Read info.plist file.
NSDictionary *infoDict = [[NSBundle mainBundle] infoDictionary];
NSString *value = [infoDict objectForKey:@"keyName"];
infoDictionary: A dictionary, constructed from the bundle's Info.plist file, that contains information about the receiver.
Read a custom .plist file
NSString *file = [[NSBundle bundleForClass:[self class]] pathForResource:"nameOfPlist" ofType:@"plist"];
if (!file) {
NSLog(@"Please add a plist config file to your project.");
return nil;
}
NSDictionary *plistDict = [NSDictionary dictionaryWithContentsOfFile:file];
Upvotes: 4