My application uses iCloud. My application stores all its data in 1 document and there should never be more than this 1 document. However, sometimes my NSMetadataQuery returns 2 documents:
0: Documents/(A Document being saved bt MyApp)/MyDoc.ext
1: Documents/MyDoc.ext
This happens mostly when the user opens the app shortly after the iOS device was rebooted.
When inspecting these 2 docs, it is document 0 that is the one with the most recent updates, so this is the one we want.
What is the reason of this "A Document Being Saved" ending up there and being the most recent one and how do I deal with this correctly, so Documents/MyDoc.ext will be the one that has the most recent content.
Thanks, -r
Open the needed file in a third-party app you work with and tap the Share button . Tap Save to Files. When the Files app is launched, tap the Documents extension in the list of app and select the folder you would like to save the file to. As a result, the file will be saved to the selected folder of the Documents app.
Save your documentClick FILE > Save, pick or browse to a folder, type a name for your document in the File name box, and click Save. Save your work as you go - hit Ctrl+S often. To print, click the FILE tab, and then click Print.
I think Stuart's comment provides most of the answer you'll get. The fact alone that the document is called "(A Document Being Saved by )" and not "(A Document Saved by ) strongly suggests he's right.
I guess it's now up to you to figure out why saving the document crashes or never finishes or gets terminated or whatever. It could be a timeout, if your app takes too long saving the document when going to the background, a crash, or something else - I don't think you've provided enough information for anyone to give you a really precise answer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With