js_55 js_55 - 5 months ago 20
Objective-C Question

In Objective-C how do you get the BuildID of device programatically

On an Apple device go to Setting -> General -> About

Look at "Version" of device in About page.

It should say something like "Version 9.0 (13A344)"

I know how to get the 9.0 programmatically in objective-C.

How can I get BuildID (i.e. 13A344) ?

I think BuildID is the correct term to use, based on what I see on http://www.ipsw.me/9.0

I could be wrong though

Answer

You could poll the SystemVersion.plist like so:

NSDictionary *systemVersion = [NSDictionary dictionaryWithContentsOfFile:@"/System/Library/CoreServices/SystemVersion.plist"];
if (systemVersion != nil) {

    NSString *sysInfo =  [NSString stringWithFormat:@"%@ %@ (Build %@)",
                    [systemVersion objectForKey:@"ProductName"],
                    [systemVersion objectForKey:@"ProductVersion"],
                    [systemVersion objectForKey:@"ProductBuildVersion"]];
}

This will get you:

ProductBuildVersion = 13E238;
ProductCopyright = "1983-2016 Apple Inc.";
ProductName = "iPhone OS";
ProductVersion = "9.3.1";
Comments