textor icon indicating copy to clipboard operation
textor copied to clipboard

Document doesn't save if app goes to background without tapping "Done"

Open louisdh opened this issue 7 years ago • 6 comments

louisdh avatar Mar 11 '18 19:03 louisdh

Hi! I could not reproduce this on the App Store version. To make the edits disappear, I have to go background then swipe up the app. Is this what you mean?

a40yostudent avatar Mar 14 '18 08:03 a40yostudent

Doesn't UIDocument save opportunistically in events, such as going to background? That's how it works for NSDocument. On app termination, it should have already saved.

LeoNatan avatar Mar 14 '18 18:03 LeoNatan

from Apple documentation:

In addition to the system terminating your app, the user can terminate your app explicitly using the multitasking UI. User-initiated termination has the same effect as terminating a suspended app. The app’s process is killed and no notification is sent to the app.

I'm looking at best practices, should be something related to applicationWillResignActive:

a40yostudent avatar Mar 15 '18 09:03 a40yostudent

That's not true. You hear in the app delegate applicationWillTerminate:.

LeoNatan avatar Mar 15 '18 13:03 LeoNatan

I made a fix to this bug. Starting a PR

Vercantez avatar Apr 05 '18 06:04 Vercantez

This is probably part of a larger discussion @louisdh in terms of what is correct behaviour with regards to auto-saving for the app.

  1. Should the app ever auto-save or should that require explicit user action?
  2. If the app provides auto-save, should we implement an UndoManager and register it with the UIDocument so that we get auto-saves happening as we go for free plus the ability to add user actions for undo/redo?

My preference would be:

  1. We should generally be auto-saving. That's (relatively) common practice on iOS, especially with users jumping in an out of apps.
  2. We should implement UndoManager and add user actions for it. It makes sense as most basic text editors have this.

aamct2 avatar Apr 10 '18 18:04 aamct2