我正在尝试使用以下代码访问相册。它在我的iPhone或iPad上运行不到4.0版本。
- (无效)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版本中崩溃,然后相同的代码将启动到相册。有人可以告诉我这里可能是什么原因吗?
答案 0 :(得分:0)
我修改了imgPickerController.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;