iOS Automatic Actions

Checking for Automatic Actions

The OpenBack SDK routinely checks to see if there are messages ready to be delivered which can wake up your app in the background. It can be important to check your

You should check your application for automatic actions in the following places and update your code to work around OpenBack's silent push and wakeup calls:

    1. Push Receivers. Background push notifications will call application:didReceiveRemoteNotification:fetchCompletionHandler: on the UIApplicationDelegate.
    1. Application Delegate. Background pushes can launch suspended apps into the background, triggering the application:willFinishLaunchingWithOptions: and application:didFinishLaunchingWithOptions: methods on your UIApplicationDelegate. You can check the launchOptions of these methods to determine if the application has been launched from a background push.

Example Code

Example
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool {
let pushDictionary = launchOptions?[UIApplicationLaunchOptionsKey.remoteNotification] as? NSDictionary as? [AnyHashable : Any] ?? [:]
// ... your code here ...
}
Example
func application(_ application: UIApplication,
didReceiveRemoteNotification userInfo: [AnyHashable : Any],
fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
// ... your code here ...
}