Prerequisites
Configure your iOS push settings in the Userpilot Settings Studio before setting up push notifications in your app. To obtain the required keys and configuration details, refer to the iOS Push Notification Guide.Setup
In Xcode, navigate to the Signing & Capabilities section of your main app target and add the Push Notifications capability. There are two options for configuring push notifications: automatic or manual. Automatic configuration is the quickest and simplest way to configure push notifications and is recommended for most customers.Automatic Configuration
Automatic configuration takes advantage of swizzling to automatically provide the necessary implementations of the requiredUIApplicationDelegate and UNUserNotificationCenterDelegate methods.
To enable automatic configuration, call Userpilot.enableAutomaticPushConfig() from UIApplicationDelegate.application(_:didFinishLaunchingWithOptions:).
Manual Configuration
Step 1. Register for Push NotificationsUserpilot.setPushToken(_:) from UIApplicationDelegate.application(_:didRegisterForRemoteNotificationsWithDeviceToken:) to pass the APNs token from calling registerForRemoteNotifications() to Userpilot.
AppDelegate to conform to the UNUserNotificationCenterDelegate protocol and assign self as the delegate in application(_:didFinishLaunchingWithOptions:).
Implement userNotificationCenter(_:didReceive:withCompletionHandler:) and pass the received notification response to Userpilot.didReceiveNotification(response:completionHandler:).
userNotificationCenter(_:willPresent:withCompletionHandler:).
AppDelegate+PushNotification.swift file in the sample app.