0

Possible Duplicate:
Determine device (iPhone, iPod Touch) with iOS
How to check iOS version?

I am using this function to get the device name

NSString *device=[UIDevice currentDevice].model;

it returns me, for example, "iPhone" .

is there a way to get the device version, for example, "iPhone 4S".

Cœur
  • 34,719
  • 24
  • 185
  • 251
user1051935
  • 579
  • 1
  • 10
  • 29

2 Answers2

1
#import <sys/utsname.h>

- (NSString *)deviceModel
{
    struct utsname systemInfo;
    uname(&systemInfo);

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

try

[[UIDevice currentDevice] platformString]

That will normally return if it is iPhone 4S...

Tobi Weißhaar
  • 1,577
  • 6
  • 25
  • 34
  • That's not a part of the standard UIDevice API: https://developer.apple.com/library/ios/#documentation/uikit/reference/UIDevice_Class/Reference/UIDevice.html – yuji Feb 13 '12 at 16:32