你好,歡迎來到IOS教程網

 Ios教程網 >> IOS編程開發 >> IOS開發綜合 >> iOS 版本信息 包含6,6plus

iOS 版本信息 包含6,6plus

編輯:IOS開發綜合

導入#import

/**

* iPhone的設備號
**/
+ (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]) {
iPhoneVersion = @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]) {
iPhoneVersion = @iPhone 5s;
}
if ([platform isEqualToString:@iPhone7,2]) {
iPhoneVersion = @iPhone 6;
}
if ([platform isEqualToString:@iPhone7,1]) {
iPhoneVersion = @iPhone 6Plus;
}

return iPhoneVersion;

}

 

  1. 上一頁:
  2. 下一頁:
蘋果刷機越獄教程| IOS教程問題解答| IOS技巧綜合| IOS7技巧| IOS8教程
Copyright © Ios教程網 All Rights Reserved