Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3939098
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T00:15:38+00:00 2026-05-20T00:15:38+00:00

I looked around to find, how I can know on which iPhone my App

  • 0

I looked around to find, how I can know on which iPhone my App is running (iPhone 3G, iPhone3GS, iPhone 4) to do additional things depending on the exactly device. The preferred method was mostly something like this:

size_t size;
sysctlbyname("hw.machine", NULL, &size, NULL, 0); 
char *name = (char *)malloc(size);
sysctlbyname("hw.machine", name, &size, NULL, 0);
NSString *machine = [NSString stringWithCString:name];
free(name);
if([machine compare:@"iPhone3,1"]==NSOrderedSame){
    //iPhone 4
}else if([machine compare:@"i386"]==NSOrderedSame){
    //Simulator
}else{
    //iPhone 3GS, 3G...
 }
NSLog(@"Device %@", machine);

This worked fine so far, but now we updated X-Code and the simulator. So its possible to run the Simulator as iPhone 4, iPhone3GS or iPhone3G. How can this be detected at runtime? Any solutions or workarounds so far?

Edit: Even a solution like here http://iphonedevelopment.blogspot.com/2009/05/device-detection.html of course isn’t working properly anymore, since an simulator can be also an iPhone4!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T00:15:39+00:00Added an answer on May 20, 2026 at 12:15 am

    Never coded for iPhone, but I Googled and found this: Apple Developer: UIDevice Class

    Or maybe this helps: iPhone – How do I detect the iPhone version?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've looked around, but can't specifically find my issue. I know that the default
I've looked around and can't seem to find an answer to this. I'm trying
I've looked around and I can't find the concise steps that I need to
I looked around for quite a bit and I can't seem to find the
I've looked around here but can't seem to find an answer to my problem.
I've looked around a bit and can't seem to find an answer. I just
I've looked around a bit and I can't seem to find the answer to
I've looked around for OpenID tutorials and I can't seem to find anything that's
I looked around and didn't find exactly what I'm looking for. I have a
Iv looked around for a existing lib/solution for what I want but can't find

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.