Hi everyone I am trying to make a camera app. I am doing this as
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
where picker is the object of UIimagepicker Controller.
But when is run the code then the application terminates showing the error.
Terminating app due to uncaught exception ‘NSInvalidArgumentException’, reason: ‘Source type 1 not available’
I am using this on simulator. I know that it is not possible to check camera in simulator, but we can test for that. I think it might be that because camera is not available thats why it’s terminating.
But I saw an application with the same code but that was running on the simulator, just showing the camera view.
Just help me out how to resolve this problem. And moreover how can I put my custom view to the camera in that app?
You need to check if the device has camera available before setting the sourcetype.
The following can check if device has camera available.
You can’t check the camera functionality from your simulator. You can assign
UIImagePickerControllerSourceTypePhotoLibraryas the sourceType to test on simulator.