Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Self-Managed Integration

To make integrations easier the PushSDK automatically integrates itself into your application delegate and user notification center by using method swizzling. You may want to disable the automatic integration in several scenarios including:

  • Conflicts with other SDKs that also include swizzling or other automatic integrations

  • Conflicting third party development solutions

  • Our method swizzling conflicts with your existing architecture

We suggest that you only consider a self-managed integration if swizzling is incompatible with existing code. If you choose to use a self-managed integration you will need to ensure that any new releases to the PushSDK do not add additional methods that must be called manually.

Add the following method call before calling PushSDK.setConfiguration:

PushSDK.disableMethodSwizzling()
[PushSDK disableMethodSwizzling];

Why the ordering matters

disableMethodSwizzling() only prevents the hooks from being installed. Installation happens during setConfiguration, so calling it afterwards prevents nothing:

  • The hooks are already in place and continue to forward every notification callback.

  • The SDK claims the UNUserNotificationCenter delegate slot during installation, and UNUserNotificationCenter provides no way to hand that slot back. The SDK therefore remains the notification delegate for the rest of the process lifetime.

If you are debugging a self-managed integration that behaves as though swizzling is still active, check that nothing runs setConfiguration ahead of your disableMethodSwizzling() call — including any code path that configures the SDK from a different entry point.

Never combine automatic and manual integration

Double processing surfaces in the device log as a duplicate completion handler invocation:

Choose one integration style and use it consistently:

  • Automatic (default) — do not call any of the manual methods listed below.

  • Self-managed — call disableMethodSwizzling() before setConfiguration, then implement every manual method listed below.

Once swizzling has been disabled you'll also be required to place calls to the PushSDK to invoke the methods that are no longer swizzled. If you do not implement all of the following methods the PushSDK may not function properly.

The methods you must call manually are:

  • application:didRegisterForRemoteNotificationsWithDeviceToken:

  • application:didFailToRegisterForRemoteNotificationsWithError:

  • application:didReceiveRemoteNotification:fetchCompletionHandler:

  • userNotificationCenter:willPresent:withCompletionHandler:

  • userNotificationCenter:didReceive:withCompletionHandler:

  • If you are targeting iOS version 10 or earlier:

    • application:didReceiveRemoteNotification:

UIApplicationDelegate Example

UNUserNotificationCenterDelegate Example

Last updated