How to programmatically differentiate between iphone 4 and iphone 4S?

后端 未结 7 1602
醉酒成梦
醉酒成梦 2020-11-29 18:08

I am working on app which needs to check the iphone model, but I\'m not able to find any solution. I will be thank full for any suggestion.

7条回答
  •  执念已碎
    2020-11-29 18:48

    Try using following : you will get all the detail informations of the Device...

    NSLog(@"uniqueIdentifier: %@", [[UIDevice currentDevice] uniqueIdentifier]);
    NSLog(@"name: %@", [[UIDevice currentDevice] name]);
    NSLog(@"systemName: %@", [[UIDevice currentDevice] systemName]);
    NSLog(@"systemVersion: %@", [[UIDevice currentDevice] systemVersion]);
    NSLog(@"model: %@", [[UIDevice currentDevice] model]);
    NSLog(@"localizedModel: %@", [[UIDevice currentDevice] localizedModel]);
    

    If above does not work for you then use github project

    EDIT :

    Whether you are on an iPhone or a iPod Touch:

    UIDevice *device = [UIDevice currentDevice];
    NSString *systemName = [device systemName];
    

    To detect the version of the OS:

    UIDevice *device = [UIDevice currentDevice];
    NSString *systemVersion = [device systemVersion];
    

    For Reference: how do I detect whether I have iPhone 2G,3G,3GS

提交回复
热议问题