Reputation: 458
I have been trying to use Branch SDK to implement deep linking into our iOS application. The Branch URL redirects directly to App Store and never attempts to open the application. I must be missing something. This works as expected on Android though.
What I've done:
Added branch_key to application plist Added URL Scheme to URL Types in the Info.plist Enabled Associated Domains in both the project and the App ID in the developer console.
Enabled all iOS deep linking settings on Branch Dashboard, set the Bundle Identifier & Apple App Prefix both correctly.
I'm copying the link generated from app pasting it on any other app and on clicking the link, Safari opens and shows go to app, then App Store is opened as if the application is not installed.
Am I missing a configuration step or what could be possible reasons for this to work like this?
Upvotes: 2
Views: 775
Reputation: 359
Check out this BranchIO help documentation and make sure you are doing the same steps.
https://help.branch.io/developers-hub/docs/ios-basic-integration
Also, check the AppDelegate.swift
file because you may have forgotten to write the code in it.
All you need to do is import BranchSDK first
import BranchSDK
and then write this code inside the application
function:
// Listener for Branch deep link data
Branch.getInstance().initSession(launchOptions: launchOptions) { (params, error) in
print(params as? [String: AnyObject] ?? {})
// Access and use deep link data here (nav to page, display content, etc.)
}
Here is my AppDelegate.swift code:
import UIKit
import Flutter
import BranchSDK
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
if #available(iOS 10.0, *) {
UNUserNotificationCenter.current().delegate = self as? UNUserNotificationCenterDelegate
}
//Add this method for Branch deep link
Branch.getInstance().initSession(launchOptions: launchOptions) { (params, error) in
print(params as? [String: AnyObject] ?? {})
// Access and use deep link data here (nav to page, display content, etc.)
}
GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
}
// This function is optional to allow BranchIO to handle push notifications
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
Branch.getInstance().handlePushNotification(userInfo)
}
Upvotes: 0