Can't read or create UIManagedDocuments anymore

71 Views Asked by At

I have a big issue in my app, which prevents creating new documents and reading them, whereas it worked well until now. I didn't change anything, and it started bugging from a build to another.

This is the code I'm using:

CLProject *project = [[CLProject alloc] initWithFileURL:projectURL];
NSLog (@"Will save project at URL: %@", projectURL);
[project saveToURL:projectURL forSaveOperation:UIDocumentSaveForCreating completionHandler:^(BOOL success) {
    NSLog (@"Project saved: %d", success);
    [...]
}];

CLProject is a subclass of UIManagedDocument.

The first NSLog is called, but not the second one. Instead I get an error :

2018-02-14 19:21:03.597495+0100 CamList[2247:750786] Will save project at URL: file:///var/mobile/Containers/Data/Application/151E38F5-2214-4876-A188-2AB8B5E8CF6A/Documents/Projects/715A0087-F2EF-439B-A2DD-8E878EF8A973.camlist

2018-02-14 19:21:03.783397+0100 CamList[2247:750886] [default] [ERROR] Could not get attribute values for item /var/mobile/Containers/Data/Application/151E38F5-2214-4876-A188-2AB8B5E8CF6A/Documents/Projects/715A0087-F2EF-439B-A2DD-8E878EF8A973.camlist (n). Error: Error Domain=NSFileProviderInternalErrorDomain Code=1 "The reader is not permitted to access the URL." UserInfo={NSLocalizedDescription=The reader is not permitted to access the URL.}

But it doesn't crash, the app keeps running (but nothing happens because the completion block never gets called).

What I don't understand is that everything was working fine and I haven't changed anything...

Can you help me??

Thanks

1

There are 1 best solutions below

0
Thomas Albert On

Well, it seems to work fine again this morning... Nothing to understand. My iPhone had to be tired...