gpt4 book ai didi

iphone - 多次调用 UIImagePickerController 后设备重启

转载 作者:行者123 更新时间:2023-12-03 17:41:17 25 4
gpt4 key购买 nike

我实现了 UIImagePickerController 委托(delegate)、UINavigationController 委托(delegate)、UIPopOverController 委托(delegate)。我不知道问题是什么。我的设备在调用 3、4 或 5 次后重新启动(每个版本都不同)。请帮我解决它!

编辑:我收到此错误:

More than maximum 5 filtered album lists trying to register. This will fail.

这是我用来调用 UIImagePickerController 并获取图像的代码:
- (IBAction)imgPickerPressed:(id)sender {
if ([UIImagePickerController isSourceTypeAvailable: UIImagePickerControllerSourceTypeCamera]) {
imgPickerTypeActionSheet = [[UIActionSheet alloc] initWithTitle:@"Choose image source:" delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil otherButtonTitles:@"Camera", @"Photo Library", nil];
[imgPickerTypeActionSheet showInView:self];
}
else {
UIImagePickerController *controller = [[UIImagePickerController alloc] init];
[controller setDelegate:self];
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary]) {
[controller setSourceType:UIImagePickerControllerSourceTypePhotoLibrary];
}
imgPickerPopOver = [[UIPopoverController alloc] initWithContentViewController:controller];
imgPickerPopOver.delegate = self;
[imgPickerPopOver presentPopoverFromRect:CGRectMake(imgPickerButton.frame.origin.x, imgPickerButton.frame.origin.x-250, 0.0, 0.0)
inView:self
permittedArrowDirections:UIPopoverArrowDirectionDown
animated:YES];
}
}
- (void)actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex {
if ([actionSheet isEqual:imgPickerTypeActionSheet]) {
if (buttonIndex == 0) {
UIImagePickerController *controller = [[UIImagePickerController alloc] init];
[controller setDelegate:self];
[controller setSourceType:UIImagePickerControllerSourceTypeCamera];

[[delegate getVC] presentModalViewController:controller animated:YES];
}
if (buttonIndex == 1) {
UIImagePickerController *controller = [[UIImagePickerController alloc] init];
[controller setDelegate:self];
[controller setSourceType:UIImagePickerControllerSourceTypePhotoLibrary];

imgPickerPopOver = [[UIPopoverController alloc] initWithContentViewController:controller];
imgPickerPopOver.delegate = self;
[imgPickerPopOver presentPopoverFromRect:CGRectMake(imgPickerButton.frame.origin.x, imgPickerButton.frame.origin.x-250, 1, 1)
inView:self
permittedArrowDirections:UIPopoverArrowDirectionDown
animated:YES];
}
}
}
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)image editingInfo:(NSDictionary *)editingInfo {
[imgPickerPopOver dismissPopoverAnimated:YES];
pickedImageView.image = image;
[self valueChanged:nil];
}

最佳答案

这在iOS模拟器中有效吗?您是否也在释放这些对象中的任何一个,还是 ARC 正在这样做? This可能会有所帮助。

关于iphone - 多次调用 UIImagePickerController 后设备重启,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8690116/

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