1

When you open up an app and press home screen again, the app is obviously in te background. When you open other apps and wait a time, the views of my app have been unloaded (like UITableView reloads data).

Is there some sort of notification or how do I know whether my app is about to release their views? Is it just viewDidUnload?

antyrat
  • 27,479
  • 9
  • 75
  • 76
lbrndnr
  • 3,361
  • 2
  • 24
  • 34

2 Answers2

0

This link should help: iPhone Development - Simulate Memory Warning

Basically you received a memory warning and parts of the view got unloaded.

Community
  • 1
  • 1
Ross Dargan
  • 5,876
  • 4
  • 40
  • 53
0

unfortunately, when you app is put in the background it is frozen and it will not receive events. Unless you have requested some background processing time and have provided the system with a background processing task Expiration Handler:

backgroundTask_ = [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:^{
     
     // Peform clean up work

     // Mark the task now as invalid
     [[UIApplication sharedApplication] endBackgroundTask:backgroundTask_];
     backgroundTask_ = UIBackgroundTaskInvalid;
 }];

in which case, after the extra, undetermined amount of processing time is over, the expiration handler will be called.

Some good background docs can be found here App States and Multitasking. But even then you won't be able to do much in the way of cleanup.

Good luck

Community
  • 1
  • 1
timthetoolman
  • 4,613
  • 1
  • 22
  • 22