2011-08-17 44 views
0

其實我可以檢測iOS版本,但是可以在iOS內檢測iPhone 3G或3GS型號?在iOS中檢測iPhone 3G

謝謝

+0

可能重複的HTTP ://stackoverflow.com/questions/1543925/how-do-i-detect-whether-i-have-iphone-2g-3g-3gs) –

+0

檢查你需要的功能(例如:視頻,電話,指南針,陀螺儀等)而不是檢查特定的型號。 – progrmr

回答

1

你可以找到使用this post(我想這也是一個重複的問題)的確切型號字符串:

#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; 
} 
的[我怎樣檢測自己是否有iPhone 2G,3G,3GS(
3

您需要檢查設備功能。 3g不支持錄像機,3g不支持前置攝像頭。 看看this的問題。