IOS version information includes 6, 6 plus

Source: Internet
Author: User

IOS version information includes 6, 6 plus

Import # import

/**

* IPhone device number
**/
+ (NSString *) iPhoneVersion
{
NSString * iPhoneVersion = nil;

Size_t size;
Sysctlbyname (hw. machine, NULL, & size, NULL, 0 );
Char * machine = (char *) malloc (size );
Sysctlbyname (hw. machine, machine, & size, NULL, 0 );
NSString * platform = [NSString stringWithCString: machine encoding: NSUTF8StringEncoding];
Free (machine );

If ([platform isEqualToString: @ iPhone1, 1]) {
IPhoneVersion = @ iPhone;
}
If ([platform isEqualToString: @ iPhone1, 2]) {
IPhoneVersion = @ iPhone 3G;
}
If ([platform isEqualToString: @ iPhone2, 1]) {
IPhoneVersion = @ iPhone 3GS;
}
If ([platform isEqualToString: @ iPhone3, 1] | [platform isEqualToString: @ iPhone3, 2] | [platform isEqualToString: @ iPhone3, 3]) {
IPhoneVersion = @ iPhone 4;
}
If ([platform isEqualToString: @ iPhone4, 1]) {
IPhone version = @ iPhone 4S;
}
If ([platform isEqualToString: @ iPhone5, 1] | [platform isEqualToString: @ iPhone5, 2]) {
IPhoneVersion = @ iPhone 5;
}
If ([platform isEqualToString: @ iPhone5, 3] | [platform isEqualToString: @ iPhone5, 4]) {
IPhoneVersion = @ iPhone 5c;
}
If ([platform isEqualToString: @ iPhone6, 1] | [platform isEqualToString: @ iPhone6, 2]) {
IPhone version = @ iPhone 5S;
}
If ([platform isEqualToString: @ iPhone7, 2]) {
IPhoneVersion = @ iPhone 6;
}
If ([platform isEqualToString: @ iPhone7, 1]) {
IPhoneVersion = @ iPhone 6 Plus;
}

Return iPhoneVersion;

}

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.