pretzels1337
pretzels1337

Reputation: 355

iOS where is applicationWillEnterBackground defined? when is it called?

Probably a novice question: I'm working with some legacy code that has an implementation for

- (void)applicationWillEnterBackground:(UIApplication *)application

There's no explicit definition of this method in the headers, so I assumed it's part of the adopted protocol (UIApplicationDelegate) however it's not included in apple's documentation.

Is this method called as a part of the app life-cycle? (Afterall the method's name closely resembles applicationDidEnterBackground which is listed as a UIApplicationDelegate method)

If it is part of the life-cycle when is it called?

Upvotes: 0

Views: 2250

Answers (1)

rob mayoff
rob mayoff

Reputation: 385660

The string applicationWillEnterBackground doesn't occur in the UIKit dynamic library. I'm pretty sure the system never sends that message.

:; strings - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/System/Library/Frameworks/UIKit.framework/UIKit | grep applicationWillEnterBackground

For comparison, the library does contain the string applicationDidEnterBackground:

:; strings - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/System/Library/Frameworks/UIKit.framework/UIKit | grep applicationDidEnterBackground
applicationDidEnterBackground:
_applicationDidEnterBackground:
-[UIActivityIndicatorView _applicationDidEnterBackground:]

Upvotes: 5

Related Questions