swift – What’s the greatest technique for saving a “Most Lately Used” doc record on iOS?


Is there a foolproof manner of saving the URL of a UIDocument so an software can resume enhancing the doc on subsequent launch?

I’ve tried varied methods of saving the URL, however typically the doc URL will barely differ from what is anticipated.

For instance, the next code:

var scoresURL = FileManager.default.urls(for: .documentDirectory,
                                             in: .userDomainMask).first!

would possibly return this:


However a documented loaded utilizing UIDocumentBrowserViewController would possibly set the fileURL path of the UIDocument to this:


It’s these slight variations that make me surprise if I’m merely doing the incorrect factor by sustaining a MRU record.

These points seem solely on an precise system. The simulator is paths are steady, a minimum of till the arbitrary occasions the simulator decides to reset its state.


Leave a Reply

Your email address will not be published. Required fields are marked *