Use the UIImagePickerController on a iphone simulator

Try this,

 if([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary])
        {
            picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
        }
        else
        {
            picker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
        }
        [self.navigationController presentModalViewController:picker animated:NO];

If you are creating the app for iPad. You will have to present the gallery in a popOver control.


Swift 3/4/5 verison:

if UIImagePickerController.isSourceTypeAvailable(.camera) {
    picker.sourceType = .camera
}
else {
    picker.sourceType = .savedPhotosAlbum // or .photoLibrary
}

Swift 2 version:

if UIImagePickerController.isSourceTypeAvailable(.Camera) {
    picker.sourceType = .Camera
}
else {
    picker.sourceType = .SavedPhotosAlbum // or .PhotoLibrary
}

In simulator, you can't use cameraCaptureMode and showsCameraControls.