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".

1
  • Oh, I linked to the wrong duplicate. Commented Feb 13, 2012 at 16:22

2 Answers 2

1
#import <sys/utsname.h>

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

    return [NSString stringWithCString:systemInfo.machine encoding:NSUTF8StringEncoding];
}
Sign up to request clarification or add additional context in comments.

2 Comments

this functon returns me "iPhone 4.1" and not "iPhone 4S" any reason ?
iPhone 4.1 = iPhone 4S, iPhone 3.1 = iPhone 4, iPhone 2.1 = iPhone 3GS, iPhone 1.2 = iPhone 3G and iPhone 1.1 = iPhone 1G.
-1

try

[[UIDevice currentDevice] platformString]

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

1 Comment

That's not a part of the standard UIDevice API: developer.apple.com/library/ios/#documentation/uikit/reference/…

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.