Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

General structure and API Quesrions #32

Open
bumpingChris opened this issue Nov 19, 2024 · 2 comments
Open

General structure and API Quesrions #32

bumpingChris opened this issue Nov 19, 2024 · 2 comments

Comments

@bumpingChris
Copy link

bumpingChris commented Nov 19, 2024

@XHMM @eveningkid
Thank you @XHMM for maintaining this library!
I'm new to iCloud syncing, and so have a few basic understanding questions. I hope you can help clarify them for me.
Is my understanding on the following correct?

  1. On the mobile device, there are two locations where files are/can be stored:

    1. Local path = app relative path (e.g. /var/mobile/Containers/Data/Application/1A6CCFDA-89DC-4FE7-8CF0-72180FD34FBB/Documents/my.db).
    2. Cloud container path = directory where files are synced to the cloud. (e.g. /private/var/mobile/Library/Mobile Documents/iCloudcomproject~app/Documents/my.db). Files here exist locally AND remotely?
  2. When we execute a method like CloudStore.download, we're getting the latest version of the file from the remote cloud container to the local cloud container? And, once downloaded, we need to use RNFS.copyFile to copy the file from the cloud container to a app-relative location (e.g. RNFS.copyFile(/private/var/mobile/Library/Mobile Documents/iCloudcomproject~app/Documents/my.db, /var/mobile/Containers/Data/Application/1A6CCFDA-89DC-4FE7-8CF0-72180FD34FBB/Documents/my.db)? Is it not good practice to reference files in the local cloud container directly from the app?

  3. What's the difference between CloudStore.download and CloudStore.startDownloadingUbiquitousItem ?

Thank you in advance for your help in all this!

Originally posted by @bumpingChris in #27 (comment)

@bumpingChris bumpingChris changed the title @XHMM @eveningkid General structure and API Quesrions Nov 19, 2024
@XHMM
Copy link
Owner

XHMM commented Nov 20, 2024

  1. Files here exist locally AND remotely?

Yes when you downloaded it, due to it exists in the cloud folder, the file content maybe changed by apple system such as sync with new version from other apple devices.

  1. When we execute a method like CloudStore.download, we're getting the latest version of the file from the remote cloud container to the local cloud container? And, once downloaded, we need to use RNFS.copy...? Is it not good practice to reference files in the local cloud container directly from the app?

Yes;
Yes;
No, becuase files in the cloud folder may changed as said in 1.

  1. What's the difference between CloudStore.download and CloudStore.startDownloadingUbiquitousItem ?

startDownloadingUbiquitousItem is just a wrapper of swift-side api it's 'low-level', download is a 'high-level' api of it, you may just use download

@bumpingChris
Copy link
Author

@XHMM Thank you so much for the clarifications.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants