Skip to content
This repository has been archived by the owner on Jul 21, 2023. It is now read-only.

Latest commit

 

History

History
45 lines (33 loc) · 1.43 KB

setDebug.md

File metadata and controls

45 lines (33 loc) · 1.43 KB

The setDebug method exists in the underlying native SDKs and the documentation for the react-native-branch SDK. Unfortunately, it is not possible to implement it in JavaScript immediately because the native methods must be called before initializing the native SDKs. Currently, the native SDKs are initialized before the JavaScript loads. By the time a React Native app calls setDebug, it is too late to call it. This is likely to change in a future release.

For now, it is necessary to make the call directly in native code on both platforms.

As of 2.0.0-beta.7, it is also possible to call setDebug using the debugMode parameter in the branch.json configuration file. See https://rnbranch.app.link/branch-json for details.

iOS

Objective-C

In AppDelegate.m, before calling [RNBranch initSessionWithLaunchOptions:isReferrable:], call [RNBranch setDebug].

[RNBranch setDebug];
[RNBranch initSessionWithLaunchOptions:launchOptions isReferrable:YES];
Swift

In AppDelegate.swift, before calling RNBranch.initSession(launchOptions:, isReferrable:), call RNBranch.setDebug().

RNBranch.setDebug()
RNBranch.initSession(launchOptions: launchOptions, isReferrable: true)

Android

In your Activity source file, e.g. MainActivity.java, before calling RNBranch.initSession(), call RNBranch.setDebug():

RNBranchModule.setDebug();
RNBranchModule.initSession(getIntent().getData(), this);