2013-03-23 5 views
-1
나는 보편적 인 응용 프로그램 작업입니다

, 그것은 아이폰presentViewController SIGABRT는

picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; 
    [self presentViewController:picker animated:YES completion:nil]; //the culprit, why? 

에 잘 작동 사전에 도움을 주셔서 감사합니다!

+0

어떻게 피커를 인스턴스화 했습니까? – WolfLink

+0

두 장치 모두 실행중인 OS는 무엇입니까? –

+0

콘솔에 전체 오류 메시지가 나타나야합니다. 오류가 무엇인지 명확하게 설명합니다. – rmaddy

답변

1

UIImagePickerViewController에 대한 문서를 읽어 보시기 바랍니다 :에 설명 된대로

표, 당신은 UIImagePickerControllerSourceTypePhotoLibrary 또는 UIImagePickerControllerSourceTypeSavedPhotosAlbum의 소스 유형을 지정하면 아이 패드에, 당신은 팝 오버 컨트롤러를 사용하여 이미지 선택기를 제시해야 함을 나타냅니다 " 프레젠테이션 및 Popover 해제 "UIPopoverController 클래스 참조. 저장된 그림과 동영상 중에서 이미지 픽커를 모달 (전체 화면)으로 표시하려고하면 시스템에서 예외가 발생합니다.

iPad에서 소스 유형을 UIImagePickerControllerSourceTypeCamera으로 지정하면 모범적으로 (전체 화면) 이미지를 표시하거나 팝 오버를 사용하여 이미지를 표시 할 수 있습니다. 그러나 Apple은 카메라 인터페이스를 전체 화면으로 만 표시 할 것을 권장합니다.

iPad의 사진 보관함 이미지 선택 도구를 사용하려면 UIPopoverController을 사용해야합니다.

0
 // While showing UIImagePickerController in iPad, you must do it using UIPopoverController as follow 


     // Declare UIPopoverController and present your UIImagePickerController using it 
     UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init]; 
     [imagePicker setDelegate:self]; 
     [imagePicker setSourceType:UIImagePickerControllerSourceTypePhotoLibrary]; 
     [imagePicker setAllowsEditing:YES]; 

     popOverController = [[UIPopoverController alloc] initWithContentViewController:imagePicker]; 
     [popOverController presentPopoverFromRect:self.view.frame inView:self.view permittedArrowDirections:UIPopoverArrowDirectionDown animated:YES];