在ios11中启动视频时,UIImagepicker控制器应用程序崩溃,但它适用于ios 10

时间:2017-11-02 11:33:53

标签: objective-c uiimagepickercontroller

这段代码在ios 10上运行正常,但是当我提出选择器时,它在ios 11上崩溃了

if ([UIImagePickerController isSourceTypeAvailable: UIImagePickerControllerSourceTypeCamera])
 {
     UIImagePickerController *pickerController = [[UIImagePickerController alloc] init];
     pickerController.delegate = self;
     pickerController.sourceType = UIImagePickerControllerSourceTypeCamera;
     pickerController.showsCameraControls = YES;
     pickerController.mediaTypes = [NSArray arrayWithObject:(NSString *)kUTTypeMovie]; // kUTTypeMovie is actually an NSString.
     pickerController.videoMaximumDuration = 30.0f; // limits video length to 30 seconds.
     [self presentViewController:pickerController animated:YES completion:nil];
 }

// Picker Delegate

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary<NSString *,id> *)info
{
     self.videoURL = info[UIImagePickerControllerMediaURL];
     [picker dismissViewControllerAnimated:YES completion: nil];
     NSString *str = [self.videoURL absoluteString];
}

0 个答案:

没有答案