gpt4 book ai didi

iphone - iOS 5 : UIImagePickerController crash

转载 作者:行者123 更新时间:2023-12-03 19:39:05 27 4
gpt4 key购买 nike

我在 iOS 5 中遇到 UIImagePickerController 问题。

我的应用程序是在 iOS4.3 中开发的,但现在我将其升级到 iOS5

当我尝试从照片库中选择图像时,我的应用程序崩溃了。

它在 EXE_BAD_ACCESS 的 main.m 文件中崩溃,并且不提供任何崩溃日志。

我正在使用以下代码进行 UIImagePickerController 从照片库中选取图像。

-(IBAction) photoLibraryAction {
if ([self isPad]) {

UIImagePickerController* picker = [[UIImagePickerController alloc] init];
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
picker.delegate = self;

UIPopoverController *popover = [[UIPopoverController alloc] initWithContentViewController:picker];
self.popoverController = popover;
//[popover release];
[popoverController presentPopoverFromRect:CGRectMake(btnLibraryPic.frame.origin.x, btnLibraryPic.frame.origin.y, btnLibraryPic.frame.size.width, btnLibraryPic.frame.size.height) inView:self.view permittedArrowDirections:UIPopoverArrowDirectionLeft animated:YES];


//[picker release];
}else {
ipc=[[UIImagePickerController alloc] init];
ipc.delegate=self;

ipc.sourceType=UIImagePickerControllerSourceTypePhotoLibrary;

[self presentModalViewController:ipc animated:YES];
}
}


#pragma mark - Image Picker Delegate
-(void)imagePickerControllerDidCancel:(UIImagePickerController *)picker
{
[[picker parentViewController] dismissModalViewControllerAnimated:YES];
[picker release];
}



-(void) imagePickerController:(UIImagePickerController *) picker didFinishPickingMediaWithInfo :(NSDictionary *)info
{

imgV.image =[info objectForKey:UIImagePickerControllerOriginalImage];

if ([self isPad]) {
[popoverController dismissPopoverAnimated:YES];
}

[[picker parentViewController] dismissModalViewControllerAnimated:YES];

[picker release];

}

我在SO上搜索过,发现了很多链接like1 , like2 , like3 , like4like5 .

但是这些都不包含任何适当的解决方案。

我应该做什么?

最佳答案

[picker dismissModalViewControllerAnimated:YES];

关于iphone - iOS 5 : UIImagePickerController crash,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8454820/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com