IOS save state for complex applications

I am creating a rather sophisticated tabbed business application for iPad IOS 4.2: 4 with potentially deep navigation paths on each tab.

According to some of your more experienced IOS developers, what would be the general expectation of the user regarding maintaining the state of the application between launches (i.e. after the application has been completely completed and subsequently restarted)? I use basic data and have all the data problems, but I am concerned about the navigation tree of the application. If the user left the 1st tab on screen 3, the second tab on screen 4, the third on screen 2, where he left the record for the new record half-filled and was at the time the application entered the background, working on the 4th tab on screen 3 .. .Do you think the average user will expect the application to remember all this the next time it starts? (My gut says yes, although I'm not sure how long.)

If so, can you suggest a general strategy to solve this problem (and, again, I'm talking about the navigation tree here, not Core Data)? For example, if the navigation controllers were used as the root view controller for each tab, it would be enough to simply write enough information about their navigation stacks to be able to restore them later. But what about things like popovers, warning / action sheets, or modal VCs created on the fly? Should each view controller record the state of its user interface objects, and if so, what is the recommended way to do this?

I know that a lot depends on the user, but I ask for a general perspective on these issues, i.e. voice of experience.

Thanks,

Wayne

+7
source share
4 answers

This is fairly simple in principle, but in practice it can be quite difficult to go through your navigation hierarchy and save material that cannot be obtained from the data model.

There, an open source implementation of this DTResurectionKit is implemented . I also documented how I do this in my applications on my website. It is similar to (but simpler) DTResurectionKit.

+6
source

According to some of your more experienced iOS developers, what would be the general expectation of the user regarding maintaining the state of the application between launches?

The best way to think about this is to make sure that the user has never had to figure out why and how they got to the place when the application opens.

It depends entirely on the type of application that you have and on the time elapsed since the last open. It looks like you have a rather complicated deployed application, so I think it's best to remember the navigation stack for a predetermined time. I use the tr20 framework, which does this automatically for me, but if you implemented it, it would be something like this:

  • If a user has opened in the last 24 hours, open the exact location on the left.
  • If the user opens within a week, open the main "section" or the application area in which they were located
  • If the user opens after a week, open the root screen.

Now, of course, these values ​​will differ depending on your features and application usage, but you get this idea. Having made some general assumptions about how people use your application and when, you can increase the user interface without pushing them so deep into your application when they don’t remember how they got there.

As for the implementation, all this is just data. You do not need to serialize live objects to store the stack, just do the data necessary to recreate the state the next time you start. What you need to store is highly dependent on your own installation ... mileage will vary. I use NSUserDefaults to store all instances of vars and navigation stack through Three20. Check out TTNavigator for a great implementation.

+4
source

I would suggest maintaining the state of each type of tab. Only at the page level. Do not worry about replenishment or incomplete data entry (I hope there is not too much intermediate state before you save it in your main data store.)

As you said, it’s easy enough to remember which tab you are on and which controller you go to each tab. Do not need anymore.

It seems that you control it, but for others: 1) when you change the tabs, keep the “active tab”, 2) when you move through the tab, keep the “active controller on the tab”, 3) when the application starts, set the “active tab ", 4) when changing tabs, set / confirm" active controller on the tab ".

The reason for 4) is that the view / controllers for the tabs will linger on loading or may never load. You do not want to set the “active controller on the tab” for a tab that is not displayed and can never be loaded into the application, it will just cause an unnecessary download. It often happens (after downloading the application) that you do not need to change it, because it is already in the correct state.

+1
source

I think your time is best spent elsewhere. Of course, your application may be perfect for this, but in our case the data was partially on the network, could fade, affect the viewing state in different navigation modes on different tabs at the same time, etc. Etc. This is not an insurmountable problem, but definitely a hard and huge sink.

We decided to spend our time fixing bugs and improving functionality. If you need to make the same choice, I'm pretty sure which option your users prefer. In particular, now your application will withstand a phone call in the background.

0
source

All Articles