iPhone App : How to get default value from root.plist?

前端 未结 7 2057
情深已故
情深已故 2020-12-14 04:09

I am working on an iPhone app

I read a key from root.plist like this :

NSString *Key1Var = [[NSUserDefaults standardUserDefaults] stringForKey:@\"Key         


        
相关标签:
7条回答
  • 2020-12-14 05:04
    NSBundle* mainBundle = [NSBundle mainBundle]; 
    

     

    // Reads the value of the custom key I added to the Info.plist
    NSString *value = [mainBundle objectForInfoDictionaryKey:@"key"];
    
    //Log the value
    NSLog(@"Value = %@", value);
    

    // Get the value for the "Bundle version" from the Info.plist
    [mainBundle objectForInfoDictionaryKey:@"CFBundleVersion"];
    
    // Get the bundle identifier
    [mainBundle bundleIdentifier];
    
    0 讨论(0)
提交回复
热议问题