UIImagePickerController在被解雇后保持“录制”视频

时间:2012-10-24 09:08:16

标签: objective-c ios xcode uiimagepickercontroller

我遇到了UIImagePickerController的一些奇怪的行为,我用它来捕捉视频。在用户录制并挑选视频并且取消视图控制器后,点击我的UITextField之一会使应用再次进入“录制”模式,但没有UIImagePickerController可见。所有发生的事情都是音量摇杆成为停止/录音按钮(按下时播放各自的铃声),键盘停止“点击”(正如录音正在进行时一样),当我关闭应用程序时我可以看到红色录制状态栏闪烁片刻。

同样,当时没有UIImagePickerController,但应用程序的行为就好像它正在记录某些内容。按音量摇杆实际“记录”某些剪辑不会将它们保存在库中(与我的didFinishPickingMediaWithInfo方法中发生的情况相反)。

以下是我如何初始化选择器:

self.cameraController = [[UIImagePickerController alloc] init];
self.cameraController.sourceType = UIImagePickerControllerSourceTypeCamera;
self.cameraController.mediaTypes = @[(NSString*)kUTTypeMovie];
self.cameraController.videoQuality = UIImagePickerControllerQualityType640x480;
self.cameraController.delegate = self;

这是我的didFinishPickingMediaWithInfo(与另一个UIImagePickerController共享,用于用户照片库,因此有一些不相关的逻辑):

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {

    // Dismiss the picker
    if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad && [picker isEqual:self.photoLibraryController])
        [self.photoLibraryPopover dismissPopoverAnimated:YES];
    else
        [picker dismissModalViewControllerAnimated:YES];

    // Save the media URL
    if (info[UIImagePickerControllerMediaURL])
        [self.uploadDataDictionary setObject:info[UIImagePickerControllerMediaURL] forKey:@"mediaURL"];

    // Identify the source of the media (camera or library)
    [self.uploadDataDictionary setObject:picker forKey:@"sourcePicker"];

    // If it comes from the camera picker, save the video in the library
    NSString *videoPath = [info[UIImagePickerControllerMediaURL] path];
    if ([picker isEqual:self.cameraController] && UIVideoAtPathIsCompatibleWithSavedPhotosAlbum(videoPath)) {
        UISaveVideoAtPathToSavedPhotosAlbum(videoPath, self, nil, nil);
    }

}

文本字段的敲击反应触发了上述奇怪:

- (void)textFieldDidBeginEditing:(UITextField *)textField {
    float textFieldPosition = textField.frame.origin.y - 20;
    [self.formView setContentOffset:CGPointMake(0, textFieldPosition) animated:YES];
}

我在应用程序的这一部分也有一堆其他按钮和textview,但没有一个按钮进入这种奇怪的“后台录制”模式。

此外,我明显将ARC用于此项目。

知道问题的原因是什么?

0 个答案:

没有答案