Simple title output in ios settings bundle

后端 未结 6 1954
名媛妹妹
名媛妹妹 2021-02-01 21:17

I just want to output the version number of my ios application in a settings file.

I understand that I have to add the settings file to the application folder.

W

6条回答
  •  既然无缘
    2021-02-01 21:40

    This worked for me :

    Edit the Root.plist as source : Right click on the file and choose Open As->Source Code

    Add the part for the title :

       PreferenceSpecifiers
            
                
                    DefaultValue
                    NoVersion
                    Key
                    Version
                    Title
                    Version
                    Type
                    PSTitleValueSpecifier
                
    

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

    Add this:

    NSString *version = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];
        [[NSUserDefaults standardUserDefaults] setObject:version forKey:@"Version"];
    

    It will work after the app has been launched the first time.

提交回复
热议问题