MobileOrg / mobileorg

MobileOrg iPhone App
http://mobileorg.github.io
GNU General Public License v2.0
557 stars 70 forks source link

iCloud sync not working #271

Open webframp opened 3 years ago

webframp commented 3 years ago

Reported by a user in https://gitter.im/MobileOrg/Lobby

Setup for iCloud sync should only be: Configure iCloud Sync in the mobile app, Initiate a sync to create the iCloud Drive folder, then configure emacs org-mobile-directory value to point to the path in your ~/Library/Mobile Documents folder

However when attempted a file name does not show in Outlines tab, but there is an empty line shown with an > indicator And with "View item as a Document" there's just a (null) headline.

webframp commented 3 years ago

@dive since you worked mostly on this feature perhaps you have an idea where best to start debugging?

chuxubank commented 3 years ago

After restart the app, the empty lines disappeared and nothing shows up even I click the sync button. BTY, the sync page (which shows "Syncing Org-files" and file names which are syncing) gone very quickly, while using WebDAV it takes a reasonable time to sync.

ghost commented 3 years ago

Not working at all for me. iPhone 11 Pro Max, iOS 14. Can't use dropbox because it's blocked by corporate firewall. Suppose I can try setting up WebDAV on one of my Raspberry Pis.

dive commented 3 years ago

@webframp, sure. I will take a look. So far, I see that the release version on AppStore does not create a proper directory in iCloud for some reason. Local builds and the last version from iTunes Connect work fine. Will investigate.

dive commented 3 years ago

Okay, there is definitely a problem with the initial sync but it works in general.

@chuxubank, @stevenbuehler, can you help us and confirm that

As the result, there will be MobileOrg directory in the iCloud storage. The easiest way to check is to open Files application on your device, go to "iCloud Drive" directory, open "MobileOrg" and check that all expected .org files are there.

P.S. @webframp, it seems that I forgot to update the documentation about iCloud sync on the user side 🤦

Thanks!

chuxubank commented 3 years ago

@dive Thanks for your help and hard work! As @webframp told me on Gitter, I got the org-mobile-directory in #246 and use Emacs to push files succefully. Here's my MobileOrg directory in iCloud on Mac. My macOS MobileOrg Directory

Here's my MobileOrg directory in iCloud on iOS

Seemed that the iOS MobileOrg app do not download the file even if I click the sync button. I tried to download these files manually but there's no luck. The only difference is that the empty lines as I mentioned above showed up Try to download ALL the files manually and it should work!

The strange empty lines The strange empty lines
dive commented 3 years ago

@chuxubank, thank you! I see the problem on the iOS side. MobileOrg has to force iCloud Drive to sync all the files within the "MobileOrg" directory, but it is not the case on your screenshot from iOS (these cloud icons on the right-side of the list). It seems that I am able to reproduce it locally as well. Perhaps, something has changed in the iCloud logic or I missed something in the implementation. Anyway, I will try to debug it and prepare a fix.

Meanwhile, you can try to download all the files manually (you have to press the cloud icon for each of the files). This will resolve the problem and from this point it has to work as expected. It is crazy, I know 😞 , but there is no button "Sync the folder" in the Files application.

chuxubank commented 3 years ago

You are right, I have to download ALL the files manually, and it works now! Thanks!

webframp commented 3 years ago

@dive I can add an update for the docs site today.

webframp commented 3 years ago

@webframp, sure. I will take a look. So far, I see that the release version on AppStore does not create a proper directory in iCloud for some reason. Local builds and the last version from iTunes Connect work fine. Will investigate.

Can confirm I'm seeing the same behavior. Works locally when I test, but the released version has the bug.

ghost commented 3 years ago

The App Store version on my 11 Max Pro created the folder in iCloud after I set up something on the phone, but it did not sync the files in the folder afterward. For the moment I’m just using Dropbox, but the fewer apps I have to deal with the better.

zellyn commented 2 years ago

So, I started the sync from the app, which is apparently bad? I tried deleting the folder, and doing org-mobile-push from emacs, which re-created the folder, and added all my org files.

However, nothing at all shows up in the app. When I hit ↻, I see a brief flash, almost too fast to see: I can barely read "Syncing Org-files" and then something smaller below. But the "Outlines" screen remains a blank screen full of lines.

Here's the weird thing: if I create a capture, and then sync, the capture will disappear forever from the mobile app. But a new file will show up in the iCloud folder, named mobileorg.org, mobileorg 2.org, etc. Those will not show up in my org dir if I do an org-mobile-pull or sync: emacs just says there are no new files.

Anyway, hope that helps… any help appreciated!

zellyn commented 2 years ago

Update: after reading #275, I deleted all the mobileorg.org files in the iCloud folder (in Finder: they were not showing up in dired 🤷), and now when I create a new capture, they end up in the same mobileorg.org file in my iCloud folder. But they still disappear completely from the app after syncing.

webframp commented 2 years ago

sorry to hear about the issues with iCloud sync @zellyn

@dive knows that feature the best, I still use Dropbox sync myself. Time has been limited lately for fixes, but we can try to take a look soon

Borklex commented 1 year ago

MobileOrg on iPhone will create a fresh capture file called mobileorg.org every time a capture or edit is pushed (pushing with neither new change won't do anything ). iCloud will regard this new file with the same name as a conflict and create a suffixed version called mobileorg.org(1) only on the receiving end. A second capture or edit with a push from iPhone will delete the conflicted file and the new one will appear as unconflicted at both ends.

A quick fix is to call a hook after (org-mobile-pull) to delete 'org-capture-file.

You still have to make two edits/captures and with a corresponding refresh for each to get rid of the conflict at the pc end though. Silly I know but it's to do with this issue :

https://developer.apple.com/library/archive/technotes/tn2336/_index.html

Borklex commented 1 year ago

Oh also - when 'org-mobile-push creates a fresh set of staging files at the iPhone end - for some reason I don't yet know - checksum.dat is the only file that won't download to the phone - as indicated by the cloud down arrow icon. Without tapping on this in the file viewer MobileOrg wont startup .

webframp commented 9 months ago

Hey @Borklex thanks for the feedback. I'll look into this issue