最多 iOS 9 闪光灯开/关/自动工作正常。但在 iOS 10 中,flash 无法正常工作。
self.camObj = [[UIImagePickerController alloc] init];
[self addCameraToTheScreen];
NSArray *mediaTypes = [NSArray arrayWithObject:(NSString*)kUTTypeMovie];
self.camObj.mediaTypes = mediaTypes ;
self.camObj.modalTransitionStyle = UIModalPresentationFullScreen;
self.camObj.sourceType = UIImagePickerControllerSourceTypeCamera;
self.camObj.videoMaximumDuration = 10.0f;
self.camObj.showsCameraControls = NO;
self.camOptionsView.frame = [UIScreen mainScreen].bounds;
self.camObj.delegate = (id<UIImagePickerControllerDelegate,UINavigationControllerDelegate>)self;
[self.camObj setCameraOverlayView:self.camOptionsView];
并以编程方式更改闪存模式。
[self.camObj setCameraFlashMode:UIImagePickerControllerCameraFlashModeOn];