2011-03-22 132 views
0

我正嘗試使用以下代碼訪問相冊。它可以在我的iPhone或iPad版本不到4.0的情況下正常工作。iPad:訪問相冊時發生崩潰

  • (無效)BrowsePhotoLibrary:(ID)發送方 {
NSArray *types = [UIImagePickerController availableMediaTypesForSourceType: 
    UIImagePickerControllerSourceTypePhotoLibrary]; 

if ([types containsObject:(id)kUTTypeMovie]) 
{ 

    UIImagePickerController *imgPickerController = [[[UIImagePickerController alloc] init] autorelease]; 
    imgPickerController.delegate = self; 
    imgPickerController.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; 
    imgPickerController.mediaTypes = [NSArray arrayWithObject:(id)kUTTypeMovie]; 

    [self presentModalViewController:imgPickerController animated:YES];    
} 

}

在ipad 2相同的代碼崩潰,4.3版本,如果有ATLEAST一個視頻可用於相冊,如果相冊沒有任何視頻,則相同的代碼會啓動到相冊。有人可能會建議這是什麼原因嗎?

+0

我修改了它通過更改imgPickerController.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum; – Getsy 2011-03-22 12:59:30

回答

0

我修改了它通過更改imgPickerController.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;