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 920947
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T18:47:55+00:00 2026-05-15T18:47:55+00:00

How do I detect if a user is running the application on an iPhone

  • 0

How do I detect if a user is running the application on an iPhone 4 or 3G/3GS?

I need to detect the hardware, not the iOS version.

thanks for any help.

  • 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-15T18:47:56+00:00Added an answer on May 15, 2026 at 6:47 pm

    feel free to use this class – I found it here

    Usage

    UIDeviceHardware *h=[[UIDeviceHardware alloc] init];
    [self setDeviceModel:[h platformString]];   
    [h release];
    

    UIDeviceHardware.h

    //
    //  UIDeviceHardware.h
    //
    //  Used to determine EXACT version of device software is running on.
    
    #import <Foundation/Foundation.h>
    
    @interface UIDeviceHardware : NSObject 
    
    - (NSString *) platform;
    - (NSString *) platformString;
    
    @end
    

    UIDeviceHardware.m

    //
    //  UIDeviceHardware.m
    //
    //  Used to determine EXACT version of device software is running on.
    
    #import "UIDeviceHardware.h"
    #include <sys/types.h>
    #include <sys/sysctl.h>
    
    @implementation UIDeviceHardware
    
    - (NSString *) platform{
        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];
        free(machine);
        return platform;
    }
    
    - (NSString *) platformString{
        NSString *platform = [self platform];
        if ([platform isEqualToString:@"iPhone1,1"]) return @"iPhone 1G";
        if ([platform isEqualToString:@"iPhone1,2"]) return @"iPhone 3G";
        if ([platform isEqualToString:@"iPhone2,1"]) return @"iPhone 3GS";
        if ([platform isEqualToString:@"iPod1,1"])   return @"iPod Touch 1G";
        if ([platform isEqualToString:@"iPod2,1"])   return @"iPod Touch 2G";
        if ([platform isEqualToString:@"i386"])   return @"iPhone Simulator";
        return platform;
    }
    
    @end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to detect if the user is using an iPhone 4, but I
Is this the proper way to detect which device a user is running? NSString
How to detect user input character in UITextView? For example:(in UITextView NOT UITextField) when
What's the fastest method, to detect User-Agent as metro UI version of internet-explorer >=10
I want to build flash application that can detect the user eyes color and
Can you please tell me if there is any library/API to detect if user
I want to develop an Java application that can detect the user logged on
How can my vbscript detect whether or not it is running in a UAC
Is there any way to detect if the iPhone wakes up from sleep while
The same way i use this to detect when user scolled down the whole

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.