Source type 1 not available

This is because you are opening a camera on the simulator(or on a device not having camera)…
since the code is something like [UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]
and obviously, the simulator doesn’t have a camera
Proceed giving an alert like this,

 if (![UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
    
    UIAlertView *myAlertView = [[UIAlertView alloc] initWithTitle:@"Error"
                                                          message:@"Device has no camera."
                                                         delegate:nil
                                                cancelButtonTitle:@"OK"
                                                otherButtonTitles: nil];
    
    [myAlertView show];
    
}
else{
     //other action
}

Swift 3:

if !UIImagePickerController.isSourceTypeAvailable(.camera) {
    let alertController = UIAlertController(title: nil, message: "Device has no camera.", preferredStyle: .alert)
    
    let okAction = UIAlertAction(title: "Alright", style: .default, handler: { (alert: UIAlertAction!) in
    })
    
    alertController.addAction(okAction)
    self.present(alertController, animated: true, completion: nil)
} else {
    // Other action
}

Nothing to worry, it will work on device correctly!

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)