Search code examples
objective-ciosipadcameradetection

How do you programmatically detect your iPad's generation?


I'm working on a program that needs to be able to detect whether or not camera hardware is present in the iPad. I assumed that the easiest way to do this was to determine what generation the device was, but if there is a simpler way to detect the hardware that works too. The iPads that this application is being designed for will likely be recently purchased and running on a standard updated version of iOS.


Solution

  • Nope You can simply check what device is being used!

    For checking all iOS devices:

    NSString *deviceType = [UIDevice currentDevice].model;
    NSLog(deviceType);
    

    In order to check for a camera

    if ([UIImagePickerController isSourceTypeAvailable: UIImagePickerControllerSourceTypeCamera])
        //there is a camera