Faksprod opened a new issue, #558:
URL: https://github.com/apache/cordova-plugin-file/issues/558

   # Bug Report
   Hi Cordova team,
   I'm not sure if it's a bug or if I misunderstood [the 
documentation](https://cordova.apache.org/docs/en/11.x/reference/cordova-plugin-file/#ios-file-system-layout)
 about `cordova-plugin-file` so any help/advices would be very appreciated (I'm 
targeting/working on an **iOS webapp**).
   
   
   ## Problem
    I'de like to read/write file in a synced folder automatically synced with 
iCloud. The goal is to be able of writing the file from **device1** and reading 
the same file from **device2** (and vice-versa). Files wouldn't have to be 
accessible from the user, only from the app (private files such as user 
preferences, user infos, etc).
   
   ### What is expected to happen?
   From the 
[doc](https://cordova.apache.org/docs/en/11.x/reference/cordova-plugin-file/#ios-file-system-layout),
 I understood that files saved into the `cordova.file.syncedDataDirectory` 
folder would be automatically synced. The value of the **syncedDataDirectory** 
key returns: 
`file:///var/mobile/Containers/Data/Application/01234-56789/Library/Cloud/`
   
   ### What does actually happen?
   I can write/read file from this folder from the **same device**, everything 
works as expected.
   However, files are not synced at all between devices.
   
   In a first time, I just like to get a confirmation from developers of this 
plugin about the goal of this `syncedDataDirectory`?
   What do you mean by "_Holds app-specific files that should be synced (e.g. 
to iCloud)_"? Do you confirm that files written on **device1** could be read 
from **device2**?
   
   
   ## Information
   <!-- Include all relevant information that might help understand and 
reproduce the problem -->
   Of course all iOS devices on which I did test are **connected** to the same 
**iCloud account**, iCloud **is enabled** in device settings, iCloud Drive **is 
enabled** (don't know if it has anything to do with), iCloud for my app **is 
enabled** too.
   
   ### Command or Code
   <!-- What command or code is needed to reproduce the problem? -->
   I have added to my `config.xml` (from [the 
doc](https://cordova.apache.org/docs/en/11.x/reference/cordova-plugin-file/#configuring-the-plugin-optional)
 but I'm not sure it would be necessary in my case):
   ```
   <preference name="iosExtraFilesystems" 
value="library,library-nosync,documents,documents-nosync,cache,bundle,root" />
   <preference name="iosPersistentFileLocation" value="Library" />
   ```
   I also tried to add **iCloud Capabilities** from Xcode (from TARGET > 
SIGNING & CAPABILITIES).
   I have created a new iCloud container `iCloud.com.company.container-name`.
   I have checked the box **iCloud Documents** in my **iCloud Capabilities**.
   I have upgraded my app build version number (such as explained in the [Apple 
Doc](https://developer.apple.com/documentation/uikit/documents_data_and_pasteboard/synchronizing_documents_in_the_icloud_environment#3743498)
 about `NSUbiquitousContainers`).
   I also tried to add these new key/value in my info`.plist`:
   ```
   <key>NSUbiquitousContainers</key>
   <dict>
   <key>iCloud.com.company.container-name</key>
       <dict>
           <key>NSUbiquitousContainerIsDocumentScopePublic</key>
           <true/>
           <key>NSUbiquitousContainerName</key>
           <string>TEST NEW CONTAINER</string>
           <key>NSUbiquitousContainerSupportedFolderLevels</key>
           <string>ANY</string>
       </dict>
   </dict>
   ```
   
   ### Environment, Platform, Device
   • cordova -v: 11.0.0
   • platform ios: 6.1.1
   • cordova-plugin-file: 7.0.0
   
   • Devices tested: iPhone7 Plus, iPhone 12 Pro, iPad Air Pro, iPad Air
   
   Thanks for your help.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to