iPhone,“试图注册超过5个筛选相册列表。这将失败。”错误。

37

当我尝试从照片库中读取图像时,出现了错误:“超过最大限制的5个筛选相册列表尝试注册。 这将失败。”无法读取图像。

有什么想法可以解决这个问题吗?


12
我不理解为什么这个被关闭了,完全看不到什么狭窄的角度... - Chris J. Karr
5
我同意。我刚遇到了这个问题,这个 Stack Overflow 的帖子在我的搜索结果中排名第一,但是它已经关闭了。嗯? - Chris Markle
3
我也遇到了同样的问题。 - caleb
1
在我的当前项目中测试过了,我可以确认在从照片库选择器调用图像选择器的第5次调用时,在iOS 5.1.1上仍会收到相同的警告,但在iOS 6.0上不再出现,因此在新的iOS版本中显然已经修复了。即使在iOS 5.1.1上收到警告,图像仍将被选择并返回给我的选择器委托,所以我想我可以接受它。 - Richard Altenburg - Brainchild
7个回答

17

我认为你没有检查源类型。 你可能正在执行

 self.sourceType =UIImagePickerControllerSourceTypePhotoLibrary;

如果是这种情况,那么您必须在直接进行赋值之前检查源类型,例如:

 if ([UIImagePickerController isSourceTypeAvailable:
     UIImagePickerControllerSourceTypePhotoLibrary]) 
  {
       // Set source to the Photo Library
       self.sourceType =UIImagePickerControllerSourceTypePhotoLibrary;

  }

希望它有所帮助


第二次打开图像选择器时,我注意到了这个问题,上面的代码解决了我的问题。 - dbslone
在iOS 5.1.1上,我检查源类型的可用性并在第5次调用图像选择器时仍然收到警告。在iOS 6.0上我没有看到这个问题,所以Apple似乎已经修复了一些东西。 - Richard Altenburg - Brainchild

8

不要这样做

self.sourceType =UIImagePickerControllerSourceTypePhotoLibrary;

使用

self.sourceType =UIImagePickerControllerSourceTypeSavedPhotosAlbum;

对我来说可行。不过看起来有点奇怪。 - agough
如果([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeSavedPhotosAlbum]){ ... } - João Nunes
这对像我这样想要访问完整照片库的人来说并不是真正的解决方案。 - Richard Altenburg - Brainchild

2
这对我很有帮助:

这对我很有帮助:

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
    [picker dismissModalViewControllerAnimated:YES];
    picker = nil;
    UIImage *image = [info objectForKey:@"UIImagePickerControllerEditedImage"];
}

我在关闭ModalViewController后设置了"picker = nil;",然后它就完美运行了 :) 希望这也能帮到你 :)

我也将选择器设置为nil,但是在iOS 5.1.1上第5次调用图像选择器时仍然会收到警告。在iOS 6.0上,苹果似乎已经修复了这个问题。 - Richard Altenburg - Brainchild

2

我同意这个观点,在 iOS < 6.0 上我们自己无法避免这个警告。 - Richard Altenburg - Brainchild
噢,好的。谢谢你分享这个,它证实了我的怀疑。 - blast_hardcheese

0

需要帮助请访问链接:http://skhousee.blogspot.in/2012/06/error-more-than-max-5-filtered-album.html

UIImagePickerController *ipc = [[UIImagePickerController alloc] init];

ipc.delegate = self;

ipc.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;

[self presentModalViewController:ipc animated:YES];

[ipc release];

-(void)viewDidAppear:(BOOL)animated {

[super viewDidAppear:animated];
[self setModalInPopover:YES];

}


0

当分配并显示UIImagePickerController超过5次时,就会出现这种情况...我猜IOS在释放/关闭UIImagePickerController时忘记注销某些内容。


-5

答案是问题只在iOS 5 Beta 6中显示出来。更新到beta 7后,问题现在已经消失了。


5
我遇到了这个问题,在于发布于2011年10月12日的xCode 4.2 (4C199)中,该版本包括iOS SDK 5(非beta版)。好的,我在这里找到另一篇文章https://dev59.com/nmsz5IYBdhLWcg3wv6ju。 - AechoLiu
是的,我也在长期发布的iOS 5中得到了这个。 - Oscar
1
我取消了我的已接受答案的勾选,因为你们是正确的。在发布的iOS 5中,我仍然遇到了同样的问题。 - SolidSnake4444
这个问题在最新的iOS 5.1版本(截止到2012年6月20日)仍然存在。 - Gavy

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接