General"> "A...">

How to get the program code "version code" and "model code"

How can I get the program code "Model Code" on the device "Settings-> General"> "About"? I would also like to know how to get the "version code" (alphanumeric code, except for the version number of the device).

+3
source share
1 answer

I'm not sure if this is what you are asking for, but I wrote this private method the other day for my application.

- (NSDictionary*)_getClientDeviceInfo
{
    UIDevice* currentDevice = [UIDevice currentDevice];

    //version
    NSString* sysVersion = [currentDevice systemVersion];

    //model
    NSString* model = [currentDevice model];

    //platform
    size_t size;
    sysctlbyname("hw.machine", NULL, &size, NULL, 0);
    char *machine = malloc(size);
    sysctlbyname("hw.machine", machine, &size, NULL, 0);
    NSString *platform = [NSString stringWithCString:machine encoding:NSUTF8StringEncoding];
    free(machine);


    NSDictionary *clientDeviceInfo = @{@"systemVersion":sysVersion, @"model":model, @"platform":platform};

    return clientDeviceInfo;

}

-1
source

All Articles