开发者

iPad: Crash occurs when accessing Photo Album

开发者 https://www.devze.com 2023-02-18 03:52 出处:网络
I am trying to a开发者_运维问答ccess Photo Album using the following code. It works fine on my iPhone or iPad less than 4.0 versions.

I am trying to a开发者_运维问答ccess 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?


I fixed it by changing imgPickerController.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;

0

精彩评论

暂无评论...
验证码 换一张
取 消