App crashes when trying to obtain photos from photo library via Image picker
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
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).
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).
In addition to "sync with iTunes", the following things might fix the problem:
- 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.
This issue is IOS5 only- have asked Apple on the dev forums, but no answer. I have not been able to repro myself, but..
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.
I wrapped this code in a @try/@catch but it's still crashing :(.
- (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
精彩评论