Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Attempt to add read-only file at path file:///var/mobile/Media/PhotoData/Photos.sqlite?

I have just updated to the new Xcode beta 6.0 and when trying to compile for an ipad mini with iOS 8 I am getting a weird error in the console:

"Attempt to add read-only file at path file:///var/mobile/Media/PhotoData/Photos.sqlite?readonly_shm=1 read/write. Adding it read-only instead. This will be a hard error in the future; you must specify the NSReadOnlyPersistentStoreOption"

This happens when executing the following code:

if ([self.rootDelegate respondsToSelector:@selector(wImageRequiresAPhotoPicker:)]){
        [self.rootDelegate wImageRequiresAPhotoPicker:(DWImage*)item];
    }

And:

-(void)wImageRequiresAPhotoPicker:(DWImage *)img{
    self.selectedWimg = img;
    DWImagePickerController *imgPicker = [[DWImagePickerController alloc] init];
    [imgPicker setDelegate:self];
    [imgPicker setSourceType:UIImagePickerControllerSourceTypePhotoLibrary];
    [imgPicker setAllowsEditing:YES];
    [imgPicker setModalPresentationStyle:UIModalPresentationCurrentContext];

    UIPopoverController *popOver = [[UIPopoverController alloc] initWithContentViewController:imgPicker];
    popOver.delegate = self;
    self.popoverImageViewController = popOver;
    [self.popoverImageViewController presentPopoverFromRect:img.frame inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];

}

Does anyone have a clue of why this is happening?

like image 592
archipestre Avatar asked Oct 01 '22 12:10

archipestre


1 Answers

Most likely a newly introduced bug in iOS 8 beta 2. Let's see how it develops.

It seems that ALAssetsLibrary requests internally read & write access to Photos.sqlite database, and it can only gain read access. I'm receiving the same error with this call:

[self.assetsLibrary enumerateGroupsWithTypes:ALAssetsGroupAll
    usingBlock:^(ALAssetsGroup *group, BOOL *stop) {

    ...
like image 136
Markus Rautopuro Avatar answered Oct 04 '22 17:10

Markus Rautopuro