I have an App in the AppStore since 2013 and it always worked flawlessly. It creates and syncs files on iCloud.
Since iOS14 startDownloadingUbiquitousItemAtURL only downloads a fraction of the existing files. If I start the App in the simulator and iOS14 (and of course on the real devices as well). If I start the App in a simulator using iOS12 or 13 it works as expected.
I don't find anything on the web regarding possible changes in the startDownloadingUbiquitousItemAtURL method.
Here's the code in question:
...
BOOL tt = [[NSFileManager defaultManager] startDownloadingUbiquitousItemAtURL:cloudFileUrl error:&error] ;
if (error != nil)
{
NSLog(@"ERROR Loading %@", cloudFileUrl) ;
}
...
tt is true and error is nil, so it seems the sync process has started correctly
However, If I try to access the files with
NSArray *dirContent = [[NSFileManager defaultManager] contentsOfDirectoryAtURL:cloudFileUrl includingPropertiesForKeys:[[NSArray alloc] initWithObjects:NSURLNameKey, nil] options:NSDirectoryEnumerationSkipsHiddenFiles error:&error];
The the array dirContent contains only 3 or 4 elements, even though the folder contains 10 files.
Any idea what the problem could be? I have opened a bug with Apple as well.
Ok, the solution ist that this call does not read some files when they are binary. Alleged text files were found.
I've replaced the call with this
and now it works again.