Manual integration

In order to make your SDK integration as easy as possible, Batch Push automatically integrates into your application delegate by using a technique called "method swizzling".

Even though we've taken the greatest care when writing our swizzling code, you may encounter some cases where you don't want that, such as:

  • Incompatibility with other SDKs that also try to integrate themselves
  • Incompatibility with third party app development solutions
  • Swizzling breaks your delegate's architecture
  • You don't want code swizzled on your behalf

That's why, starting with Batch 1.5.3, we support a fully manual integration of the SDK.

We advise that you only resort to this if swizzling is problematic. On most apps this is not a problem, but if you manually integrate, you will have to check the changelogs on each update to see if Batch requires new methods for the manual integration.

To disable automatic integration, simply call:

  • Swift
  • Objective-C

This must be done before [BatchSDK startWithAPIKey:].

Then, you'll have to put calls to BatchPush where needed, in order to ensure that all Batch Push functionality works. Not implementing any of them will cause issues.

Here's a sample app delegate:

  • Swift
  • Objective-C
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
    BatchSDK.start(withAPIKey: "YOUR API KEY")

    // You MUST have a UNUserNotificationCenterDelegate implementation.
    // Batch provides BatchUNUserNotificationCenterDelegate as a default one: if you have your own, integrate Batch into it.
    // See "Intercepting notifications" for more info.
    // Available from Batch 1.16

    // Ask for the permission to display notifications
    // The push token will automatically be fetched by the SDK
    // Alternatively, you can call requestNotificationAuthorization later
    // But, you should always refresh your token on each application start
    // This will make sure that even if your user's token changes, you still get notifications
    // BatchPush.refreshToken();
    return true

func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {

Legacy documentation

If using Batch 1.15 or lower on an application that supports iOS 8 and 9, you need to implement some extra methods:

  • Swift
  • Objective-C
func application(_ application: UIApplication, didRegister notificationSettings: UIUserNotificationSettings) {


func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any]) {

func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
    completionHandler(.newData) // Adjust the result accordingly

On iOS 10 and higher, you should also implement UNUserNotificationCenterDelegate. How to correctly integrate it with Batch does not change in manual mode, and is detailed in Intercepting Notifications.