Skip to content

Advanced integration guide

This section provides information on advanced integration of the Pushwoosh iOS SDK.

Background modes

To enable this functionality, you must add Background Modes to your project.

Steps to enable background modes

  1. Open your project in Xcode and select it in the Project Navigator.
  2. Choose your app target from the left panel.
  3. Navigate to the Signing & Capabilities tab.
  4. Click the + Capability button in the upper-left corner.
  5. Search for and select Background Modes from the list.
  6. In the Background Modes section, enable Remote notifications by checking the box.

Once completed, your app will be able to handle push notifications, including silent ones, while running in the background.

Foreground modes

By default, Pushwoosh iOS SDK displays the notification banner when the app is running in the foreground.

You can control this behavior by setting the following boolean flag in your code (i.e., in your AppDelegate):

// Set false to disable foreground notifications, true to enable it
Pushwoosh.sharedInstance().showPushnotificationAlert = true

Log level

The Pushwoosh iOS SDK supports the following logging levels:

  • NONE - No logs from SDK.
  • ERROR - Displays only error messages in the console.
  • WARNING - Displays warnings in addition to errors.
  • INFO - Includes informational messages (default setting).
  • DEBUG - Includes detailed debug information.

By default, the logging level is set to INFO, ensuring the SDK provides relevant information without cluttering the developer console.

To modify the logging level, update the Pushwoosh_LOG_LEVEL key in your app’s Info.plist file:

<key>Pushwoosh_LOG_LEVEL</key>
<string>YOUR_LOG_LEVEL</string>

Replace YOUR_LOG_LEVEL with the desired level (e.g., DEBUG or ERROR).

Custom UNNotificationCenterDelegate

If you want to use your own UNNotificationCenterDelegate (for example, for local notifications), you should inform Pushwoosh SDK about it for proper behavior. You can do it with the notificationCenterDelegateProxy property of the Pushwoosh instance:

Pushwoosh.sharedInstance()?.notificationCenterDelegateProxy.add(my_delegate)

Then, implement UNNotificationCenterDelegate methods in your delegate:

func userNotificationCenter(
_ center: UNUserNotificationCenter,
willPresent notification: UNNotification,
withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void
) {
if (!PWMessage.isPushwooshMessage(notification.request.content.userInfo)) {
// Handle your notification
completionHandler(UNNotificationPresentationOptions.alert)
}
}
func userNotificationCenter(
_ center: UNUserNotificationCenter,
didReceive response: UNNotificationResponse,
withCompletionHandler completionHandler: @escaping () -> Void
) {
if (!PWMessage.isPushwooshMessage(response.notification.request.content.userInfo)) {
// Handle your notification
completionHandler()
}
}

Complete list of Info.plist properties

PropertyDescriptionPossible Values
Pushwoosh_APPIDSets the Pushwoosh application ID for production build.XXXXX-XXXXX
Type: String
Pushwoosh_APPID_DevSets the Pushwoosh application ID for development build.XXXXX-XXXXX
Type: String
Pushwoosh_SHOW_ALERTShows notification foreground alert.YES (default) / NO
Type: Boolean
Pushwoosh_ALERT_TYPESets the notification alert style.BANNER (default) / ALERT / NONE
Type: String
Pushwoosh_BASEURLOverrides the Pushwoosh server base URL.https://cp.pushwoosh.com/json/1.3/ (default)
Type: String
Pushwoosh_AUTO_ACCEPT_DEEP_LINK_FOR_SILENT_PUSHIf YES, Deep Links received in silent pushes will be processed automatically.YES (default) / NO
Type: Boolean
Pushwoosh_ALLOW_SERVER_COMMUNICATIONAllows the SDK to send network requests to Pushwoosh servers.YES (default) / NO
Type: Boolean
Pushwoosh_ALLOW_COLLECTING_DEVICE_DATAAllows the SDK to collect and send device data (OS version, locale, and model) to the server.YES (default) / NO
Type: Boolean
Pushwoosh_ALLOW_COLLECTING_DEVICE_OS_VERSIONAllows the SDK to collect and send the device’s OS version to the server.YES (default) / NO
Type: Boolean
Pushwoosh_ALLOW_COLLECTING_DEVICE_LOCALEAllows the SDK to collect and send the device locale to the server.YES (default) / NO
Type: Boolean
Pushwoosh_ALLOW_COLLECTING_DEVICE_MODELAllows the SDK to collect and send the device model to the server.YES (default) / NO
Type: Boolean
Pushwoosh_LOG_LEVELPushwoosh SDK logging level. For details, refer to Controlling Log Level.NONE / ERROR / WARNING / INFO (default) / DEBUG / VERBOSE
Type: String
Pushwoosh_PURCHASE_TRACKING_ENABLEDAllows the SDK to track in-app purchases. Needed for Customer Journey Builder.YES / NO (default)
Type: Boolean