3
My problem is this. I need that when the user starts my App, it comes back with the data that was on the screen before closing it. So my initial idea, is when the app enters Background it records a Plist with the information that was on the screen and when it starts again it loads this Plist and sends it to the Viewcontroller where this information is...
But how do I get the information uploaded to Appdelegate to my Viewcontroller?
PS: Feel free to question my solution and/or give a more plausible solution to the problem.
It’s just two pieces of information, a Nsstring and a Nsnumber... in case you search for this information saved when the app is started I used
UIApplicationDidFinishLaunchingNotification
... that’s for sure?– David Batista
ARC does not control this Observer removal? Or do I really need to remove on
-dealloc
?– David Batista
If there are only two attributes, saving in Nsuserdefaults is simpler and faster. I do not think it is necessary to read the figures in the Appdelegate. You can do this in -viewDidLoad from Viewcontroller, because if the app is closed, Viewcontroller will be created when the new execution.
– Rafael Leão
As for the removal of Observer, it is usually not necessary to do it manually. It depends on when in the life cycle of the VC it was added. For example, add to
-viewWillAppear
, the right is to remove in the-viewWillDisappear
.– Rafael Leão