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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T08:38:21+00:00 2026-06-01T08:38:21+00:00

I need to determine what iPad version my app is running on before setting

  • 0

I need to determine what iPad version my app is running on before setting up an openGl surface.

If it’s running on the old iPad 1, it is way too slow to enable antialiasing, while on iPad 2+3 there should be no performance issues, so I need to detect this first.

Any ideas on how to detect the iPad generation using Monotouch?

  • 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-01T08:38:22+00:00Added an answer on June 1, 2026 at 8:38 am

    Thanks Joachim, your hint led me to the following solution, which I have tested on physical 1 – 3 generation iPads, and it should also be able to detect other Apple devices:

    public enum HardwareVersion
    {
            iPhone2G,
            iPhone3G,
            iPhone3Gs,
            iPhone4,
            iPod1G,
            iPod2G,
            iPod3G,
            Simulator,
            iPad1G,
            iPad2G,
            iPad3G,
            Unknown
    }
    
    
    [DllImport(MonoTouch.Constants.SystemLibrary)]
    static internal extern int sysctlbyname ([MarshalAs(UnmanagedType.LPStr)] string property, IntPtr output, IntPtr oldLen, IntPtr newp, uint newlen);
    
    public static HardwareVersion getHardwareVersion()
        {
            string HardwareProperty = "hw.machine";
    
            // get the length of the string that will be returned
            var pLen = Marshal.AllocHGlobal (sizeof(int));
            sysctlbyname (HardwareProperty, IntPtr.Zero, pLen, IntPtr.Zero, 0);
    
            var length = Marshal.ReadInt32 (pLen);
    
            // check to see if we got a length
            if (length == 0) {
                    Marshal.FreeHGlobal (pLen);
                    return HardwareVersion.Unknown;
            }
    
            // get the hardware string
            var pStr = Marshal.AllocHGlobal (length);
            sysctlbyname (HardwareProperty, pStr, pLen, IntPtr.Zero, 0);
    
            // convert the native string into a C# string
            var hardwareStr = Marshal.PtrToStringAnsi (pStr);
            var ret = HardwareVersion.Unknown;
    
            // determine which hardware we are running
            if (hardwareStr == "iPhone1,1")
                    ret = HardwareVersion.iPhone2G; 
            else if (hardwareStr == "iPhone1,2")
                    ret = HardwareVersion.iPhone3G; 
            else if (hardwareStr == "iPhone2,1")
                    ret = HardwareVersion.iPhone3Gs; 
            else if (hardwareStr == "iPhone3,1")
                    ret = HardwareVersion.iPhone4; 
            else if (hardwareStr == "iPod1,1")
                    ret = HardwareVersion.iPod1G; 
            else if (hardwareStr == "iPod2,1")
                    ret = HardwareVersion.iPod2G; 
            else if (hardwareStr == "iPod3,1")
                    ret = HardwareVersion.iPod3G; 
            else if (hardwareStr == "iPad1,1")
                    ret = HardwareVersion.iPad1G; 
            else if (hardwareStr == "iPad2,1")
                    ret = HardwareVersion.iPad2G; 
            else if (hardwareStr == "iPad3,1")
                    ret = HardwareVersion.iPad3G; 
            else if (hardwareStr == "i386" || hardwareStr == "x86_64"  || hardwareStr == "x86_32" )
                    ret = HardwareVersion.Simulator;
    
            // cleanup
            Marshal.FreeHGlobal (pLen);
            Marshal.FreeHGlobal (pStr);
    
            return ret;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to determine the clients .NET framework version in my web application. I'm
We need to determine a quick way for our web application deployed in a
I need to determine which version of GTK+ is installed on Ubuntu Man does
I am working on an iPad app using appcelarator titanium and need to iterate
I need to determine which version of browser the user is using, however compatibility
I need to determine the highest .NET framework version installed on a desktop machine
I have a universal app for ipad and iphone. What I'm trying to determine
I have an iPad app with UI written in OpenGL ES 2.0, some UI
My winform application is launched by another application (the parent), I need determine the
I need to determine in 80% if a file is binary or text, is

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.