Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does iCloud sometimes stops working?

I sometimes have a problem with opening UIDocuments which are stored on iCloud. I call the following code at the very beginning of my app after checking if iCloud is available and getting the results of the NSMetaDataQuery. This works in 98% of all cases. It's just sometimes (e.g. sometimes after re-installing the app) that the completionHandler will never be called:

FRNBDocument *doc = [[FRNBDocument alloc] initWithFileURL:fileURL];
[doc openWithCompletionHandler:^(BOOL success) {

    NSLog(@"... doc: openedWithCompletionHandler");

As you can see from the code, I'm initialising a new UIDocument instance (FRNBDocument), so it can't be the case than an old UIDocument is still open and thus this one fails to open.

The only way to get the app working again is to kill it and then go to the settings.app > iCloud > Documents & Data and turn it OFF and then turn it ON again. When I go back to the app, the UIDocs will be loaded without a problem.

I've noticed that other apps (e.g. xTrail by sophiestication) have the same problem and that I can only get them running again after doing the trick described above.

What is going on?

like image 558
n.evermind Avatar asked Aug 31 '12 16:08

n.evermind


1 Answers

OK, this seems to be an iCloud bug. I've been in touch with Apple and they suggested to file a bug report. And so I did (id 12260670).

What I'll do now is to simply implement a timer. If the UIDocs have not loaded after 20 secs, I'll show an AlertView, telling the user to go to the settings.app > iCloud > Documents & Data and turn it OFF and then turn it ON again.

This is so frustrating. Unbelievable.

like image 109
n.evermind Avatar answered Oct 23 '22 06:10

n.evermind