2

我遇到了一些奇怪的行为UIImagePickerController,我用它来捕捉视频。在用户录制并选择视频并关闭视图控制器后,点击 my 之一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];
}

我在应用程序的那个部分还有一堆其他按钮和一个文本视图,但它们都没有让它进入这种奇怪的“背景记录”模式。

另外,很明显,我在这个项目中使用了 ARC。

知道问题的原因是什么吗?

4

0 回答 0