UIImagePickerController - How do I access the front facing camera by default?
UIImagePickerControllerCameraDeviceFront
is not a valid enum for the sourceType
property. The sourceType
property defines whether you're using the camera or the photo library. You need to set the cameraDevice
property instead.
Objective-C
self.imgPicker.sourceType = UIImagePickerControllerSourceTypeCamera;self.imgPicker.cameraDevice = UIImagePickerControllerCameraDeviceFront;
Swift 2
imgPicker.sourceType = .CameraimgPicker.cameraDevice = .Front
Swift 3
imgPicker.sourceType = .cameraimgPicker.cameraDevice = .front