2011年8月30日 星期二

UIDevice detect the specific model ~識別設備機型


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

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

結果:
@"i386" on the simulator  (我的出現x86_64)
@"iPod1,1" on iPod Touch
@"iPhone1,1" on iPhone
@"iPhone1,2" on iPhone 3G
@"iPhone2,1" on iPhone 3GS
@"iPad1,1" on iPad
@"iPhone3,1" on iPhone 4.
@"iPad2,1" on iPad2

沒有留言:

張貼留言