In Objective-C how do you get the BuildID of devic

2019-09-04 19:44发布

问题:

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.

回答1:

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";