2014-02-19 4 views
0

iPad의 설정에서 제한을 사용하고 카메라와 FaceTime을 허용하지 않았으며 개인 정보 탭에서 사진 용 액세스를 사용하지 않도록 설정했습니다. 내가 코드 아래 사용하여 카메라 및 사진 라이브러리를 열고있어iPad에서 카메라의 제한을 설정하면 카메라가 열려있는 동안 NSException이 발생합니다.

,

//For camera 
UIImagePickerController *picker = [[UIImagePickerController alloc] init]; 
picker.sourceType = UIImagePickerControllerSourceTypeCamera; 
picker.delegate = self; 
picker.allowsEditing = NO; 
[self.view.window.rootViewController presentViewController:picker animated:YES completion:nil]; 

//For Photo library 
UIImagePickerController *picker = [[UIImagePickerController alloc] init]; 
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; 
picker.delegate = self; 
picker.allowsEditing = NO; 
[self.view.window.rootViewController presentViewController:picker animated:YES completion:nil]; 

사진 라이브러리를 여는 동안, 그것은 명확하게 액세스가 거부 메시지를 표시하며 설정 응용 프로그램에서 변경할 수 있습니다. 카메라를 여는 동안 그러나, 응용 프로그램 충돌 오류를 던지고,

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Source type 1 not available' *** First throw call stack: (0x30584f4b 0x3ac566af 0x32f56d69 0x1141d9 0x32ee4d03 0x32d2c713 0x32d2c6b3 0x32d2c691 0x32d1811f 0x32d2c107 0x32d2bdd9 0x32d26e65 0x32cfc79d 0x32cfafa3 0x30550183 0x3054f653 0x3054de47 0x304b8c27 0x304b8a0b 0x3518c283 0x32d5c049 0xeff7d 0x3b15eab7) libc++abi.dylib: terminating with uncaught exception of type NSException

어떻게이 문제를 해결하려면? 당신은 항상 소스 유형 어떠했는지를 확인해야합니다

답변

2

사용할 수 있습니다 :

장치가 원하는 소스로부터 컨텐츠를 따기 할 수 있는지 확인 애플 UIImagePickerController doucmentatiom에서

. 이 메서드는 isSourceTypeAvailable: 클래스 메서드 에서 UIImagePickerControllerSourceType 열거 형 상수를 제공합니다. 소스 거세한 숫양

확인이 가능 같다 :

if ([UIImagePickerController isSourceTypeAvailable: UIImagePickerControllerSourceTypePhotoLibrary]) { 
// UIImagePickerControllerSourceTypePhotoLibrary is available. 
}