Pulsate1 by default takes ownership of the AppDelegate and sends callbacks back to your AppDelegate. If needed you can inform Pulsate to not take ownership of the AppDelegate, but you will need to send the needed AppDelegate callbacks to Pulsate.

1. Taking ownership of the AppDelegate and UNUserNotificationCenterDelegate

To inform Pulsate that you want to be the main AppDelegate all you need to do is use this method in the "didFinishLaunchingWithOptions" callback.

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  PULPulsateManager* pulsateManager = [PULPulsateFactory getInstanceWithAuthorizationData:authData withLocationEnabled:YES withPushEnabled:YES withLaunchOptions:launchOptions withPulsateAppDelegate:NO andPulsateNotificationDelegate:NO error:&error];
}
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
    pulsateManager = try? PULPulsateFactory.getInstanceWith(authData as? PULAuthorizationData, withLocationEnabled: true, withPushEnabled: true, withLaunchOptions: launchOptions, withPulsateAppDelegate: false, andPulsateNotificationDelegate:false)
}

"withPulsateAppDelegate:NO" informs Pulsate that it should not take ownership of the AppDelegate. "andPulsateNotificationDelegate:NO" informs Pulsate that it should not take ownership of the UNUserNotificationCenterDelegate.

2. Getting the PulsateSystemManager

For Pulsate to function properly you must send the AppDelegate and UNUserNotificationCenterDelegate Callbacks to the PulsateSystemManager. To get the PulsateSystemManager with the "UIApplicationDelegate" all you need to do is call:

id<UIApplicationDelegate> pulsateSystemManager;
pulsateSystemManager = [pulsateManager getPulsateSystemManager];
var pulsateSystemManager: UIApplicationDelegate?
pulsateSystemManager = pulsateManager?.getPulsateSystemManager()

To get the PulsateSystemManager as both an "UIApplicationDelegate" and a "UNUserNotificationCenterDelegate" all you need to do is extend the pulsateSystemManager:

id<UIApplicationDelegate, UNUserNotificationCenterDelegate> pulsateSystemManager;
pulsateSystemManager = [pulsateManager getPulsateSystemManager];
var pulsateSystemManager:(UIApplicationDelegate & UNUserNotificationCenterDelegate)?
pulsateSystemManager = pulsateManager?.getPulsateSystemManager()

3. AppDelegate Callbacks

Pulsate needs many AppDelegate Callbacks to function properly. To inform Pulsate about the AppDelegate callback simply call the proper method in the "pulsateSystemManager".

Here you can find the full list of callbacks, and how to send them to Pulsate.

-(void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
    [pulsateSystemManager application:application didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];
}

-(void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error
{
    [pulsateSystemManager application:application didFailToRegisterForRemoteNotificationsWithError:error];
}

-(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler
{
    [pulsateSystemManager application:application didReceiveRemoteNotification:userInfo fetchCompletionHandler:completionHandler];
}

-(BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options
{
    return [pulsateSystemManager application:app openURL:url options:options];
}

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
    return [pulsateSystemManager application:application openURL:url sourceApplication:sourceApplication annotation:annotation];
}

- (void)applicationDidBecomeActive:(UIApplication *)application {
    [pulsateSystemManager applicationDidBecomeActive:application];
}

-(void)applicationWillEnterForeground:(UIApplication *)application
{
    [pulsateSystemManager applicationWillEnterForeground:application];
}

-(void)applicationDidEnterBackground:(UIApplication *)application
{
    [pulsateSystemManager applicationDidEnterBackground:application];
}

- (void)applicationWillResignActive:(UIApplication *)application {
    [pulsateSystemManager applicationWillResignActive:application];
}

- (void)applicationWillTerminate:(UIApplication *)application {
    [pulsateSystemManager applicationWillTerminate:application];
}
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
    pulsateSystemManager?.application!(application, didRegisterForRemoteNotificationsWithDeviceToken: deviceToken);
}
    
func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) {
    pulsateSystemManager?.application!(application, didFailToRegisterForRemoteNotificationsWithError: error);
}
    
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
  	pulsateSystemManager?.application!(application, didReceiveRemoteNotification: userInfo, fetchCompletionHandler: completionHandler);
}
    
func applicationWillResignActive(_ application: UIApplication) {
    pulsateSystemManager?.applicationWillResignActive!(application)
}
    
func applicationDidEnterBackground(_ application: UIApplication) {
    pulsateSystemManager?.applicationDidEnterBackground!(application)
}
    
func applicationWillEnterForeground(_ application: UIApplication) {
    pulsateSystemManager?.applicationWillEnterForeground!(application)
}
    
func applicationDidBecomeActive(_ application: UIApplication) {
    pulsateSystemManager?.applicationDidBecomeActive!(application)
}
    
func applicationWillTerminate(_ application: UIApplication) {
    pulsateSystemManager?.applicationWillTerminate!(application)
}

4. UNUserNotificationCenterDelegate callbacks

- (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)(void))completionHandler
{
	NSDictionary *userInfo = response.notification.request.content.userInfo;
  if ([userInfo[@"sender"] isKindOfClass:[NSString class]]) {
  	NSString *sender = userInfo[@"sender"];
    if ([sender isEqualToString:@"Pulsate"]) {
    	// Pulsate was the sender of the push, let Pulsate handle the Push
     [pulsateSystemManager userNotificationCenter:center didReceiveNotificationResponse:response withCompletionHandler:completionHandler];
      return;
    }
  }

	// Pulsate was not the sender of the push, handle it manually
  completionHandler();
}

- (void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler
{
	NSDictionary *userInfo = notification.request.content.userInfo;

	if ([userInfo[@"sender"] isKindOfClass:[NSString class]]) {
  	NSString *sender = userInfo[@"sender"];
    	if ([sender isEqualToString:@"Pulsate"]) {
      	// Pulsate was the sender of the push, let Pulsate handle the Push
        [pulsateSystemManager userNotificationCenter:center willPresentNotification:notification withCompletionHandler:completionHandler];
        return;
      }
	}

  // Pulsate was not the sender of the push, handle it manually
  completionHandler(UNNotificationPresentationOptionAlert | UNNotificationPresentationOptionBadge | UNNotificationPresentationOptionSound);
}
func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void)
{
  let userInfo = notification.request.content.userInfo
  if (userInfo["sender"] is String) {
    let sender = userInfo["sender"] as? String
    if (sender == "Pulsate") {
      // Pulsate was the sender of the push, let Pulsate handle the Push
      pulsateSystemManager?.userNotificationCenter!(center, willPresent: notification, withCompletionHandler: completionHandler)
      return
    }
  }    
  // Pulsate was not the sender of the push, handle it manually
  completionHandler([.alert, .badge, .sound])
}
    
func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
  let userInfo = response.notification.request.content.userInfo
  if (userInfo["sender"] is String) {
    let sender = userInfo["sender"] as? String
    if (sender == "Pulsate") {
      // Pulsate was the sender of the push, let Pulsate handle the Push
      pulsateSystemManager?.userNotificationCenter!(center, didReceive: response, withCompletionHandler: completionHandler)
      return
    }
  }
  completionHandler()
}

❗️

UNUserNotificationCenterDelegate with Deployment Target below iOS 10

If your deployment target is below iOS 10 you can not use the UNUserNotificationCenterDelegate as a global variable, it is only available in iOS 10 and above. Instead use the pulsateManager to give you the pulsateSystemManager variable when needed. Example: pulsateManager?.getPulsateSystemManager().userNotificationCenter!(center, didReceive: response, withCompletionHandler: completionHandler)