Re: Sharing Files Between My Apps via iCloud
Re: Sharing Files Between My Apps via iCloud
- Subject: Re: Sharing Files Between My Apps via iCloud
- From: Uli Kusterer <email@hidden>
- Date: Tue, 23 Oct 2018 09:03:35 +0200
AFAIK the .icloud files are placeholders iCloud creates for Finder to show
while a file is still downloading (there will be a little indicator next to it
in Finder list view showing it's still downloading.
You should probably just ignore those files and wait until iCloud has finished
downloading.
Their content is probably just information needed to show the progress in
Finder, if anything at all. Or it is partial file data, maybe with space
already reserved for the final size.
Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de
On 16. Sep 2018, at 20:27, Michal L. Wright <email@hidden> wrote:
> I have apps for Mac OS (myMacApp) and iOS (myIOSApp) that use the same file
> format. The apps can synchronize files using WiFi or Dropbox.
>
> Now I’m working on using iCloud for synchronization. I’m using the same
> approach that works with Dropbox, which is:
>
> 1. myIOSApp can read from and write to the app folder on Dropbox.
>
> 2. If the file has not been previously synced, a copy can be written to
> Dropbox for uploading to myIOSApp.
>
> 3. Once copies of the file exist on both platforms, they can be synced after
> one or both has been edited.
>
> 4. If the copy in myIOSApp has been edited, that copy is written to Dropbox.
>
> 5. In myMacApp, when the sync menu item is selected, myMacApp looks for the
> file (by name) on Dropbox, downloads it and saves it with a temporary file
> name.
>
> 6. The temporary file is compared with the original, and any differences are
> resolved.
>
> 7. The temporary file is deleted from the Mac, and myMacApp writes the
> resolved file to Dropbox.
>
> 8. myIOSApp reads the resolved file from Dropbox.
>
> I’ve gotten to the point that both myMacApp and myIOSApp can read from and
> write to the same ubiquity container, using NSFileManager routines.
>
> When myMacApp reads files from iCloud, the files have the correct file
> extension, something like this: MyFile.xten
>
> When myIOSApp running on the iPhone reads files that it wrote, the file names
> are fine, but when reading files written by myMacApp, they look like this:
> .MyFile.xten.icloud
>
> I was thinking that I must be missing something regarding how entitlements or
> info.plist were set up for each app, but it turns out that files written by
> myIOSApp running on the iPad are treated the same way. And, myIOSApp running
> on the iPad treats files that were written from the same app running on the
> iPhone the same way.
>
> The ubiquity container can be viewed in Terminal on the Mac by typing ls -r
> "Library/Mobile Documents/iCloud~com~mycompany~myiosapp”
>
> When the files are listed in Terminal, all I see are the file names, with
> nothing to differentiate them based on which app wrote them, nor based on
> which device they came from. None of them have the leading period or the
> trailing .icloud.
>
> I also use the following to create a listing of the files in the ubiquity
> container:
>
> NSURL *iCloudURL = [[NSFileManager defaultManager]
> URLForUbiquityContainerIdentifier:nil];
> if (iCloudURL)
> NSArray* fileList = [[NSFileManager defaultManager]
> contentsOfDirectoryAtPath:iCloudURL.path error:NULL];
>
> I step through the fileList array and use fprintf to show the paths. They
> show the same problem with the leading period and trailing icloud.
>
> Trying to work around the modified file names hasn’t produced any useful
> results so far. If I read the files with the incorrect name, the content is
> incorrect. If I strip off the the leading period and trailing icloud before
> trying to read, the read fails.
>
> I would appreciate any insights as to the cause of the problem and, of
> course, it’s solution.
>
> Thanks,
> Mike Wright
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden