第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

如何在IOS上獲得設(shè)備的制造和模型?

如何在IOS上獲得設(shè)備的制造和模型?

開(kāi)心每一天1111 2019-06-28 15:26:15
如何在IOS上獲得設(shè)備的制造和模型?我想知道是否有可能確定當(dāng)前設(shè)備是什么類型的iPhone(例如)?我知道這是有可能讓模型通過(guò)NSString *deviceType = [[UIDevice currentDevice] model];它只會(huì)返回,無(wú)論我有“iPhone”還是“iPod”,但我想知道是否有可能檢測(cè)/知道我是否有iPhone3GS和iPhone4S(實(shí)際上,我真正想做的就是確定我是否有3G,因?yàn)槲易龅氖窍喈?dāng)圖形化的東西).所以是的,讓我知道,謝謝!
查看完整描述

3 回答

?
慕勒3428872

TA貢獻(xiàn)1848條經(jīng)驗(yàn) 獲得超6個(gè)贊

我添加了一些故障安全,以支持尚未包括在列表中的未來(lái)設(shè)備:

#import?<sys/utsname.h>#import?"MyClass.h"@implementation?MyClass{
????//(your?private?ivars)}-?(NSString*)?deviceName{
????struct?utsname?systemInfo;

????uname(&systemInfo);

????NSString*?code?=?[NSString?stringWithCString:systemInfo.machine
????????????????????????????????????????encoding:NSUTF8StringEncoding];

????static?NSDictionary*?deviceNamesByCode?=?nil;

????if?(!deviceNamesByCode)?{

????????deviceNamesByCode?=?@{@"i386"??????:?@"Simulator",
??????????????????????????????@"x86_64"????:?@"Simulator",
??????????????????????????????@"iPod1,1"???:?@"iPod?Touch",????????//?(Original)
??????????????????????????????@"iPod2,1"???:?@"iPod?Touch",????????//?(Second?Generation)
??????????????????????????????@"iPod3,1"???:?@"iPod?Touch",????????//?(Third?Generation)
??????????????????????????????@"iPod4,1"???:?@"iPod?Touch",????????//?(Fourth?Generation)
??????????????????????????????@"iPod7,1"???:?@"iPod?Touch",????????//?(6th?Generation)???????
??????????????????????????????@"iPhone1,1"?:?@"iPhone",????????????//?(Original)
??????????????????????????????@"iPhone1,2"?:?@"iPhone",????????????//?(3G)
??????????????????????????????@"iPhone2,1"?:?@"iPhone",????????????//?(3GS)
??????????????????????????????@"iPad1,1"???:?@"iPad",??????????????//?(Original)
??????????????????????????????@"iPad2,1"???:?@"iPad?2",????????????//
??????????????????????????????@"iPad3,1"???:?@"iPad",??????????????//?(3rd?Generation)
??????????????????????????????@"iPhone3,1"?:?@"iPhone?4",??????????//?(GSM)
??????????????????????????????@"iPhone3,3"?:?@"iPhone?4",??????????//?(CDMA/Verizon/Sprint)
??????????????????????????????@"iPhone4,1"?:?@"iPhone?4S",?????????//
??????????????????????????????@"iPhone5,1"?:?@"iPhone?5",??????????//?(model?A1428,?AT&T/Canada)
??????????????????????????????@"iPhone5,2"?:?@"iPhone?5",??????????//?(model?A1429,?everything?else)
??????????????????????????????@"iPad3,4"???:?@"iPad",??????????????//?(4th?Generation)
??????????????????????????????@"iPad2,5"???:?@"iPad?Mini",?????????//?(Original)
??????????????????????????????@"iPhone5,3"?:?@"iPhone?5c",?????????//?(model?A1456,?A1532?|?GSM)
??????????????????????????????@"iPhone5,4"?:?@"iPhone?5c",?????????//?(model?A1507,?A1516,?A1526?(China),?A1529?|?Global)
??????????????????????????????@"iPhone6,1"?:?@"iPhone?5s",?????????//?(model?A1433,?A1533?|?GSM)
??????????????????????????????@"iPhone6,2"?:?@"iPhone?5s",?????????//?(model?A1457,?A1518,?A1528?(China),?A1530?|?Global)
??????????????????????????????@"iPhone7,1"?:?@"iPhone?6?Plus",?????//
??????????????????????????????@"iPhone7,2"?:?@"iPhone?6",??????????//
??????????????????????????????@"iPhone8,1"?:?@"iPhone?6S",?????????//
??????????????????????????????@"iPhone8,2"?:?@"iPhone?6S?Plus",????//
??????????????????????????????@"iPhone8,4"?:?@"iPhone?SE",?????????//
??????????????????????????????@"iPhone9,1"?:?@"iPhone?7",??????????//
??????????????????????????????@"iPhone9,3"?:?@"iPhone?7",??????????//
??????????????????????????????@"iPhone9,2"?:?@"iPhone?7?Plus",?????//
??????????????????????????????@"iPhone9,4"?:?@"iPhone?7?Plus",?????//
??????????????????????????????@"iPhone10,1":?@"iPhone?8",??????????//?CDMA
??????????????????????????????@"iPhone10,4":?@"iPhone?8",??????????//?GSM
??????????????????????????????@"iPhone10,2":?@"iPhone?8?Plus",?????//?CDMA
??????????????????????????????@"iPhone10,5":?@"iPhone?8?Plus",?????//?GSM
??????????????????????????????@"iPhone10,3":?@"iPhone?X",??????????//?CDMA
??????????????????????????????@"iPhone10,6":?@"iPhone?X",??????????//?GSM
??????????????????????????????@"iPhone11,2":?@"iPhone?XS",?????????//
??????????????????????????????@"iPhone11,4":?@"iPhone?XS?Max",?????//
??????????????????????????????@"iPhone11,6":?@"iPhone?XS?Max",?????//?China
??????????????????????????????@"iPhone11,8":?@"iPhone?XR",?????????//

??????????????????????????????@"iPad4,1"???:?@"iPad?Air",??????????//?5th?Generation?iPad?(iPad?Air)?-?Wifi
??????????????????????????????@"iPad4,2"???:?@"iPad?Air",??????????//?5th?Generation?iPad?(iPad?Air)?-?Cellular
??????????????????????????????@"iPad4,4"???:?@"iPad?Mini",?????????//?(2nd?Generation?iPad?Mini?-?Wifi)
??????????????????????????????@"iPad4,5"???:?@"iPad?Mini",?????????//?(2nd?Generation?iPad?Mini?-?Cellular)
??????????????????????????????@"iPad4,7"???:?@"iPad?Mini",?????????//?(3rd?Generation?iPad?Mini?-?Wifi?(model?A1599))
??????????????????????????????@"iPad6,7"???:?@"iPad?Pro?(12.9\")",?//?iPad?Pro?12.9?inches?-?(model?A1584)?
??????????????????????????????@"iPad6,8"???:?@"iPad?Pro?(12.9\")",?//?iPad?Pro?12.9?inches?-?(model?A1652)?
??????????????????????????????@"iPad6,3"???:?@"iPad?Pro?(9.7\")",??//?iPad?Pro?9.7?inches?-?(model?A1673)
??????????????????????????????@"iPad6,4"???:?@"iPad?Pro?(9.7\")"???//?iPad?Pro?9.7?inches?-?(models?A1674?and?A1675)
??????????????????????????????};
????}

????NSString*?deviceName?=?[deviceNamesByCode?objectForKey:code];

????if?(!deviceName)?{
????????//?Not?found?on?database.?At?least?guess?main?device?type?from?string?contents:

????????if?([code?rangeOfString:@"iPod"].location?!=?NSNotFound)?{
????????????deviceName?=?@"iPod?Touch";
????????}
????????else?if([code?rangeOfString:@"iPad"].location?!=?NSNotFound)?{
????????????deviceName?=?@"iPad";
????????}
????????else?if([code?rangeOfString:@"iPhone"].location?!=?NSNotFound){
????????????deviceName?=?@"iPhone";
????????}
????????else?{
????????????deviceName?=?@"Unknown";
????????}
????}

????return?deviceName;}//?(rest?of?class?implementation?omitted)@end

我還省略了詳細(xì)的信息(例如“A 1507,A 1516,A 1526(中國(guó)),A 1529_Global”),并將其放在注釋中,以防您想將其用作面向用戶的字符串,而不是嚇到它們。



查看完整回答
反對(duì) 回復(fù) 2019-06-28
  • 3 回答
  • 0 關(guān)注
  • 840 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)