Prerequisites:
Create the iOS Application
- Integrate the BranchIO pod and do required configurations as guided in link https://help.branch.io/developers-hub/docs/ios-basic-integration
- Generate the Deeplink from the backend
- 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
}
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?