iPad:访问相册时发生崩溃
我正在尝试使用以下代码访问相册。它在我的 iPhone 或 iPad 4.0 以下版本上运行良好。
- (void)浏览照片库:(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 版本中崩溃,如果相册中没有任何视频,则相同的代码会启动到相册。有人可以建议这可能是什么原因吗?
I am trying to access Photo Album using the following code. It works fine on my iPhone or iPad less than 4.0 versions.
- (void)BrowsePhotoLibrary:(id)sender
{
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];
}
}
The same code crashes in iPad 2, 4.3 version if there is atleast one video available in Photo Albums, if Photo album doesn't have any video, then the same code launches to Photo Album. Could someone advise what could be the reason here?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我通过更改 imgPickerController.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum; 修复了它
I fixed it by changing imgPickerController.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;