Hi all.
I'm trying to develop an SDK that will register on events when the app is going to the background [like background fetch Or significant location change]. for that reason I need to write code in the appDelegate methods
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
And:
- (void)applicationDidEnterBackground:(UIApplication *)application
The question is, How can I do it without damaging the hosting app app delegate.
I tried categorizing, but in order to do that I need to know the appDelegate
I read a bit about methods swizzling But I can't figure out How to change the appdelegate method and not run it over.
If anyone can give an example sample code or link that will help clear things out It will be much appreciated.
Thanks.
You can use this two notifications:
UIApplicationDidFinishLaunchingNotification
UIApplicationDidEnterBackgroundNotification
You can read more about them here: https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIApplication_Class/#//apple_ref/c/data/UIApplicationDidFinishLaunchingNotification