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

[ad_1]

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:

file:///var/cellular/Containers/Information/Utility/50E947C1-7A30-40A0-8BB6-1C3BB41A1218/Paperwork  

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

file:///non-public/var/cellular/Containers/Information/Utility/50E947C1-7A30-40A0-8BB6-1C3BB41A1218/Paperwork  

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.

[ad_2]

Leave a Reply

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