Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to deal with (A Document being saved by MyApp) files?

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

like image 854
Rene Limberger Avatar asked Jan 30 '13 16:01

Rene Limberger


People also ask

How save a file from an app?

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.

How do you save a document in documents?

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.


1 Answers

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.

like image 136
ecotax Avatar answered Sep 25 '22 15:09

ecotax