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

  • Home
  • SEARCH
  • 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 8465491
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T15:03:52+00:00 2026-06-10T15:03:52+00:00

I’m searching for a way to detect the device my app is running on.

  • 0

I’m searching for a way to detect the device my app is running on. I am not interested in software version. I searched many questions but none of them (surprisingly) satisfy my needs for following reasons:

Solution 1:

NSString *deviceType = [UIDevice currentDevice].model;

This does not work because it gives me just “iPad”. I want to know whether it is iPad, iPad 2, new iPad, iPhone 3GS, iPhone4 etc.

Solution 2: Not testing for device type, checking for individual capabilities

This does not apply because I want this data to collect user statistics, not to perform any device specific operation.

Solution 3: Using UIDeviceHardware found here

This code looks pretty outdated and seems to access private data on the device. There is even debate whether an app using this will get approved or not. More importantly, I have no idea how it works 🙂 An alternative is also found here

Are any of the last two I mentioned safe to use? Are they future compliant? Do they comply with Apple approval rules?

Or is there any other method to get around this?

Thanks in advance.

  • 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-06-10T15:03:54+00:00Added an answer on June 10, 2026 at 3:03 pm

    Apple uses such an API in it’s sample code. To Quote the LargeImageDownsizing example project, in the file LargeImageDownsizingViewController.m beginning with line 83:

    Choosing appropriate resulting image size and tile size can be done,
    but is left as an exercise to the developer. Note that the device
    type/version string (e.g. “iPhone2,1” can be determined at runtime
    through use of the sysctlbyname function:

    size_t size;
    sysctlbyname("hw.machine", NULL, &size, NULL, 0);
    char *machine = malloc(size);
    sysctlbyname("hw.machine", machine, &size, NULL, 0);
    NSString* _platform = [NSString stringWithCString:machine encoding:NSASCIIStringEncoding];
    free(machine);
    

    _platform in my case would be iPod4,1 for an iPod touch 4th gen.

    This code is what is at the root of both of the Github examples you posted.

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

Sidebar

Related Questions

I want to count how many characters a certain string has in PHP, but
I have a French site that I want to parse, but am running into
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
This could be a duplicate question, but I have no idea what search terms
I know there's a lot of other questions out there that deal with this
Seemingly simple, but I cannot find anything relevant on the web. What is the
I am currently running into a problem where an element is coming back from

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.