1
현재, 나는 이미지 & 비디오 캡처를위한 카메라 & 비디오보기를 열려면이 코드를 사용하고 있습니다 : 그것은 잘 작동하고동적으로 반복적으로 열고 카메라 뷰
- (BOOL) startCameraControllerFromViewController: (UIViewController*) controller
usingDelegate: (id <UIImagePickerControllerDelegate,
UINavigationControllerDelegate>) delegate
{
[optionView removeFromSuperview];
if (([UIImagePickerController isSourceTypeAvailable:
UIImagePickerControllerSourceTypeCamera] == NO)
|| (delegate == nil)
|| (controller == nil))
return NO;
if (videoModeFlag==TRUE)
{
cameraUI.sourceType = UIImagePickerControllerSourceTypeCamera;
cameraUI.mediaTypes = [[NSArray alloc] initWithObjects: (NSString *) kUTTypeMovie, nil];
cameraUI.allowsEditing = NO;
cameraUI.delegate = delegate;
[self presentViewController:cameraUI animated:YES completion:nil];
videoModeFlag=FALSE;
}
else
{
photoclick.sourceType = UIImagePickerControllerSourceTypeCamera;
photoclick.delegate = self;
[self presentViewController:photoclick animated:YES completion:nil];
}
return YES;
}
. 하지만 카메라보기를 반복해서 열려고하고 사용 단추를 클릭하면 이미지를 디렉터리에 저장하려고합니다. 이것은 내가 시도하는 것입니다 :
- (void) imagePickerController: (UIImagePickerController *) picker didFinishPickingMediaWithInfo: (NSDictionary *) info
{
saveFlag =TRUE;
[self.view addSubview:typename];
image = [[info objectForKey:UIImagePickerControllerOriginalImage] copy];
mediaType = [[info objectForKey: UIImagePickerControllerMediaType] copy];
movieURL = [[info valueForKey:UIImagePickerControllerMediaURL] copy];
[self dismissViewControllerAnimated:YES completion:nil];
timer = [NSTimer scheduledTimerWithTimeInterval:10.0
target:self
selector: @selector(targetMethod)
userInfo:nil
repeats:YES];
- (void)targetMethod
{
a++;
[self startCameraControllerFromViewController: self
usingDelegate: self];
if (a==5)
{
[timer invalidate];
}
}
그러나 카메라를 반복적으로 열 수 없습니다.
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Application tried to present modally an active controller <ViewController: 0x49bab0>.'
을 내가 타이머를 사용하고 있지 않다 때 다음이 내가 뭐하는 거지입니다 : : 여기 오류 얻을 수있다
- (void) imagePickerController: (UIImagePickerController *) picker didFinishPickingMediaWithInfo: (NSDictionary *) info
{
saveFlag =TRUE;
//[self.view addSubview:typename];
image = [[info objectForKey:UIImagePickerControllerOriginalImage] copy];
mediaType = [[info objectForKey: UIImagePickerControllerMediaType] copy];
movieURL = [[info valueForKey:UIImagePickerControllerMediaURL] copy];
[self dismissViewControllerAnimated:YES completion:nil];
NSMutableArray *sd=[[NSMutableArray alloc]init];
sd = [[getPickerData componentsSeparatedByString: @"\n--- end of page ---\n"] mutableCopy];
NSLog(@"sd:%@",sd);
for (int i=0; i<=[sd count]; i++)
{
[self startCameraControllerFromViewController: self
usingDelegate: self];
}
}
나는이 시점에서 막혔어요. 이 문제를 어떻게 해결할 수 있습니까? 고맙습니다.
자체 캡처 메서드를 호출하는 데 사용하고 있지만 문제는 동일합니다 ... – Vishal
수정 된 코드를 업데이트 하시겠습니까? –
내 질문을 업데이 트 ... – Vishal