Manual integration
BatchPush.disableAutomaticIntegration()[BatchPush disableAutomaticIntegration];func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
BatchPush.disableAutomaticIntegration()
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
BatchUNUserNotificationCenterDelegate.registerAsDelegate()
// Ask for the permission to display notifications
// The push token will automatically be fetched by the SDK
BatchPush.requestNotificationAuthorization()
// 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) {
BatchPush.handleDeviceToken(deviceToken)
}Legacy documentation
Last updated

