2012-10-15 4 views
1

xcode 4.5에서 사진 앨범을 불러 오려고하면 응용 프로그램이 다운됩니다. 참고 : 앱 방향을 가로 모드로 설정했습니다. 당신의 논리에at self.view presentviewcontroller : iOS 6의 UIImagePickerController

UIImagePickerController *picker=nil; 
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeSavedPhotosAlbum]) 
{ 
    picker = [[UIImagePickerController alloc] init]; 
    picker.delegate = self; 
    picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; 

    picker.allowsEditing = NO; 
    picker.mediaTypes = [UIImagePickerController availableMediaTypesForSourceType: 
      UIImagePickerControllerSourceTypeSavedPhotosAlbum]; 

} 

if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) { 
    [self presentViewController:picker animated:YES completion:nil]; 
} 
+0

코드가보기 컨트롤러에 있습니까? –

+0

예외/오류/충돌은 어떻게 생겼습니까? –

+0

좀 더 자세히 설명해 주실 수 있습니까? 두 번째 문장에 도달했을 때 첫 번째 문장이 참임을 어떻게 확신 할 수 있습니까? presentViewController :::를 호출 할 때 picker가 nil이 아닌지 어떻게 확신 할 수 있습니까? –

답변

1

한 오류가 아이폰에 isSourceTypeAvailable 반환 NO 당신이 nil의 컨트롤러를 제시하려고 시도하는 경우이다.