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
  • 37,241
  • 25
  • 195
  • 267
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,617
  • 6
  • 26
  • 35
  • 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