iOS BranchIO DeepLink returns nil value in launchOptions in AppDelete class

353 views Asked by At

Prerequisites:

Create the iOS Application

  1. Integrate the BranchIO pod and do required configurations as guided in link https://help.branch.io/developers-hub/docs/ios-basic-integration
  2. Generate the Deeplink from the backend
  3. Tap on Deep-link will observer that launchOptions will be nil value

After integration of BranchIO into Swift iOS project, Sometimes I am getting nil value to launchOptions?

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: 
    [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
      // listener for Branch Deep Link data
     Branch.getInstance().initSession(launchOptions: launchOptions) { (params, error) in  
     // do stuff with deep link data (nav to page, display content, etc)
     print(params as? [String: AnyObject] ?? {})
   }
   return true
}
1

There are 1 answers

0
Ghufran On

launchOptions dictionary may be empty in situations where the user launched the app directly.

refer this https://developer.apple.com/documentation/uikit/uiapplicationdelegate/1622921-application

Is launchOptions nil when opening app from deeplink?