Detect iPad model

Hi there,

Is there any way to detect the iPad model at runtime?

In particular I’m looking for a way to detect if the app is running on an iPad1 instead of an iPad2 and iPad3.

Many thanks!

I hope this thread can help you

Use camera to detect if it is ipad2 or later version.
And you can use enable retina to detect if it is new ipad.

So the logic codes may be

if (not have camera)
{
    it is ipad1
}

else
{
    if (can enable retina)
    {
        it is ipad3
    }
    else 
    {
        it is ipad2 here
    }
}

Minggo Zhang wrote:
>

Use camera to detect if it is ipad2 or later version.
And you can use enable retina to detect if it is new ipad.
>
So the logic codes may be
[…]

Hi,

Many thanks for your reply.

The example uses object-c code. How can I add this to my C++ project?

Many thanks!

Change .cpp to .mm, than you can mix use object-c and c/c++ in the same file.
You can refer to the implementation of SimpleAudioEngine for more detail information.

Minggo Zhang wrote:

Change .cpp to .mm, than you can mix use object-c and c/c++ in the same file.
You can refer to the implementation of SimpleAudioEngine for more detail information.

Many thanks again - I’ll try that! :slight_smile: