tags:

views:

119

answers:

1

this function is called automatically when quit application..but in my application this function cannot called automatically

+1  A: 

This method is only called on your ApplicationDelegate instance so is this where you put your code?

If you need to be notified of when your application enters background outside of the ApplicationDelegate you can register with NSNotificationCenter.

[[NSNotificationCenter defaultCenter] addObserver: whatever
    selector: @selector(enteredBackground:) 
    name: UIApplicationDidEnterBackgroundNotification
    object: nil];

This will work in any class, but you obviously need to create the method enteredBackground or whatever you call it :)

willcodejavaforfood
sir how we set multitasking enabled in iphone
sidhu
You do that in your application plist
willcodejavaforfood
but unless you disabled multitasking it will be enabled by default. You do need iOS4 though
willcodejavaforfood