The following is constantly returned when launching from link with iOS but Android works fine.
{"+is_first_session":false,"+clicked_branch_link":false,"+non_branch_link":"https://yourapp.app.link/?someparam=123"}
I'm just getting started with React Native Branch, I've got to the point where my Android App is opening via the link provided, and is subscribing successfully and recognising branch link with passed in params but when it comes to the iOS app whilst the app is opening succesfully following the link, and subscribing, it doesn't appear to be recognising a branch link, nor when params are passed in.
I've modified AppDelegate.m as required:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[RNBranch initSessionWithLaunchOptions:launchOptions isReferrable:YES];
NSURL *jsCodeLocation;
Added Open URL (Already has FBSDKApplicationDelegate)
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
BOOL handled = [[FBSDKApplicationDelegate sharedInstance] application:application
openURL:url
sourceApplication:options[UIApplicationOpenURLOptionsSourceApplicationKey]
annotation:options[UIApplicationOpenURLOptionsAnnotationKey]
];
if (![RNBranch.branch application:application openURL:url options:options]) {
// do other deep link routing for the Facebook SDK, Pinterest SDK, etc
}
return YES;
// Add any custom logic here.
return handled;
}
Continue user activity
- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray *restorableObjects))restorationHandler {
return [RNBranch continueUserActivity:userActivity];
}
@end
I've then added live and test for branch_key in the info.plist
I've configured universal linkng adding the corresponding applinks:xxxx.app.link for my respective app replacing xxxx with such.
Thanks very much, I'm not sure if I'm missing some configuration here for iOS but it appears to be working okay with Android.
Full disclosure, I work at Branch
The reason why your app is not able to detect the Branch link could be because your app is using the test key and you are using the links created in the live version of the app. To check if your app is using the test key, you can create a link in the test version of your app on the Branch dashboard and click on the link. If you get +clicked_branch_link:true it means your app is using the test key. (The links in the test version are of the format: https://yourapp-test.app.link/sbjdsRS).
You can ensure your app is using the live key instead of the test key by:
Completely removing the test key from your info.plist OR
Making sure you are not enabling Test Mode in your application (You can enable the test mode by using branch.setDebug() OR Branch.setUseTestBranchKey(true) in your AppDelegate)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With