尝试通过图像选择器从照片库中获取照片时,应用程序崩溃

时间:2022-03-09 23:10:09

Anyone encountered this error before when trying to access the photo library using the image picker?

任何人在尝试使用图像选择器访问照片库之前遇到此错误?

NSInvalidArgumentException  Cannot set metadata in read-only store.

Any advise on what actually went wrong and suggestions on how I can resolve this will be greatly appreciated.

任何关于实际出错的建议以及如何解决这个问题的建议将不胜感激。

A snapshot of the error stack is shown below

错误堆栈的快照如下所示

尝试通过图像选择器从照片库中获取照片时,应用程序崩溃

2 个解决方案

#1


6  

There's a post on the dev forums which might be slightly helpful (it's curiously marked "Apple Confidential Information" despite iOS 5 being released).

在开发论坛上有一篇帖子可能稍微有点帮助(尽管iOS 5被发布,它还是被奇怪地标记为“Apple机密信息”)。

We've been seeing these too. My first impression was that it was related to using PhotoStream while not being connected to iCloud, but "recordVersion:forStore:" suggests it's trying to upgrade the photo library to the 5.0 format (which it presumably can't do as an unprivileged/sandboxed/etc process).

我们也一直在看这些。我的第一印象是它与使用PhotoStream而没有连接到iCloud有关,但是“recordVersion:forStore:”表示它正在尝试将照片库升级到5.0格式(它可能不能作为非特权/沙盒来做) / etc process)。

In addition to "sync with iTunes", the following things might fix the problem:

除了“与iTunes同步”之外,以下内容可能会解决问题:

  • Launching Photos
  • 启动照片
  • Launching Camera and taking a picture
  • 启动相机并拍照

This doesn't seem to have been fixed in OS 5.0.1, but the number of reports has drastically reduced, suggesting people's photo libraries are eventually being upgraded.

这似乎没有在OS 5.0.1中修复,但报告的数量已大幅减少,这表明人们的照片库最终正在升级。

#2


5  

This issue is IOS5 only- have asked Apple on the dev forums, but no answer. I have not been able to repro myself, but..

这个问题只是IOS5-在开发论坛上问苹果,但没有答案。我无法自责,但..

My beta testers reported that syncing with iTunes seems to clear this error up- so my guess is that iTunes sync is fixing a permissions problem.

我的测试版测试人员报告说,与iTunes同步似乎可以清除此错误 - 所以我的猜测是iTunes同步正在解决权限问题。

I wrapped this code in a @try/@catch but it's still crashing :(.

我把这个代码包装在@ try / @ catch中,但它仍然崩溃:(。

- (void)showImagePicker {
 UIImagePickerController *imagePicker = [[[UIImagePickerController alloc] init] autorelease];     
 imagePicker.delegate = self;
 imagePicker.hidesBottomBarWhenPushed = YES;
 imagePicker.allowsEditing = YES;
 imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
 [tabController presentModalViewController:imagePicker animated:YES];  // sometimes crash 
}

also getting the same crash infrequently/non-reproducibly for other users when I call UIImageWriteToSavedPhotosAlbum

当我打电话给UIImageWriteToSavedPhotosAlbum时,其他用户也很少/不可重复地发生同样的崩溃

#1


6  

There's a post on the dev forums which might be slightly helpful (it's curiously marked "Apple Confidential Information" despite iOS 5 being released).

在开发论坛上有一篇帖子可能稍微有点帮助(尽管iOS 5被发布,它还是被奇怪地标记为“Apple机密信息”)。

We've been seeing these too. My first impression was that it was related to using PhotoStream while not being connected to iCloud, but "recordVersion:forStore:" suggests it's trying to upgrade the photo library to the 5.0 format (which it presumably can't do as an unprivileged/sandboxed/etc process).

我们也一直在看这些。我的第一印象是它与使用PhotoStream而没有连接到iCloud有关,但是“recordVersion:forStore:”表示它正在尝试将照片库升级到5.0格式(它可能不能作为非特权/沙盒来做) / etc process)。

In addition to "sync with iTunes", the following things might fix the problem:

除了“与iTunes同步”之外,以下内容可能会解决问题:

  • Launching Photos
  • 启动照片
  • Launching Camera and taking a picture
  • 启动相机并拍照

This doesn't seem to have been fixed in OS 5.0.1, but the number of reports has drastically reduced, suggesting people's photo libraries are eventually being upgraded.

这似乎没有在OS 5.0.1中修复,但报告的数量已大幅减少,这表明人们的照片库最终正在升级。

#2


5  

This issue is IOS5 only- have asked Apple on the dev forums, but no answer. I have not been able to repro myself, but..

这个问题只是IOS5-在开发论坛上问苹果,但没有答案。我无法自责,但..

My beta testers reported that syncing with iTunes seems to clear this error up- so my guess is that iTunes sync is fixing a permissions problem.

我的测试版测试人员报告说,与iTunes同步似乎可以清除此错误 - 所以我的猜测是iTunes同步正在解决权限问题。

I wrapped this code in a @try/@catch but it's still crashing :(.

我把这个代码包装在@ try / @ catch中,但它仍然崩溃:(。

- (void)showImagePicker {
 UIImagePickerController *imagePicker = [[[UIImagePickerController alloc] init] autorelease];     
 imagePicker.delegate = self;
 imagePicker.hidesBottomBarWhenPushed = YES;
 imagePicker.allowsEditing = YES;
 imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
 [tabController presentModalViewController:imagePicker animated:YES];  // sometimes crash 
}

also getting the same crash infrequently/non-reproducibly for other users when I call UIImageWriteToSavedPhotosAlbum

当我打电话给UIImageWriteToSavedPhotosAlbum时,其他用户也很少/不可重复地发生同样的崩溃