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

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

檢測(cè)特定的iPhone/iPodtouch型號(hào)

檢測(cè)特定的iPhone/iPodtouch型號(hào)

縹緲止盈 2019-07-15 10:48:08
檢測(cè)特定的iPhone/iPodtouch型號(hào)我正在制作一個(gè)游戲,利用iphone(可能還有iPodtouch第二代)的點(diǎn)對(duì)點(diǎn)藍(lán)牙功能。然而,為了阻止用戶在iPod1Gen和iPhone2G上玩多人游戲,我需要檢查特定的設(shè)備型號(hào)。[UIDevicecurrentDevice]型號(hào)]只會(huì)告訴我這款設(shè)備是“iPhone”還是“iPodtouch”。有沒(méi)有辦法檢查具體的設(shè)備型號(hào),比如“iPhone3GS”、“iPodTouch第一代”等等。編輯:UIDevice有一個(gè)類(lèi)別(我認(rèn)為它是由EricaSadun創(chuàng)建的,我不認(rèn)為它值得稱(chēng)贊),它使用下面的代碼來(lái)獲得特定的設(shè)備模型。您可以在這里找到整個(gè)類(lèi)別以及其他有用的內(nèi)容:https://github.com/erica/uidevice-extension#include <sys/types.h>#include <sys/sysctl.h>@implementation UIDevice (Hardware)/*  Platforms  iPhone1,1 -> iPhone 1G  iPhone1,2 -> iPhone 3G   iPod1,1   -> iPod touch 1G   iPod2,1   -> iPod touch 2G  */- (NSString *) platform{   size_t size;   sysctlbyname("hw.machine", NULL, &size, NULL, 0);   char *machine = malloc(size);     sysctlbyname("hw.machine", machine, &size, NULL, 0);     NSString *platform = [NSString stringWithCString:machine encoding:NSUTF8StringEncoding];   free(machine);   return platform;}這個(gè)工作和應(yīng)用程序使用這個(gè)最近已經(jīng)批準(zhǔn)在AppStore。
查看完整描述

3 回答

?
暮色呼如

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

您可以使用uname從…sys/utsname.h..例如:

#import <sys/utsname.h>NSString*machineName(){
    struct utsname systemInfo;
    uname(&systemInfo);

    return [NSString stringWithCString:systemInfo.machine
                              encoding:NSUTF8StringEncoding];}

結(jié)果應(yīng)該是:

@"i386"      on the simulator
@"iPod1,1"   on iPod Touch
@"iPod2,1"   on iPod Touch Second Generation
@"iPod3,1"   on iPod Touch Third Generation
@"iPod4,1"   on iPod Touch Fourth Generation
@"iPhone1,1" on iPhone
@"iPhone1,2" on iPhone 3G
@"iPhone2,1" on iPhone 3GS
@"iPad1,1"   on iPad
@"iPad2,1"   on iPad 2
@"iPad3,1"   on iPad 3 (aka new iPad)
@"iPhone3,1" on iPhone 4
@"iPhone4,1" on iPhone 4S
@"iPhone5,1" on iPhone 5
@"iPhone5,2" on iPhone 5


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

添加回答

舉報(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)