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.
In AppDelegate.m, before calling [RNBranch initSessionWithLaunchOptions:isReferrable:]
,
call [RNBranch setDebug]
.
[RNBranch setDebug];
[RNBranch initSessionWithLaunchOptions:launchOptions isReferrable:YES];
In AppDelegate.swift, before calling RNBranch.initSession(launchOptions:, isReferrable:)
,
call RNBranch.setDebug()
.
RNBranch.setDebug()
RNBranch.initSession(launchOptions: launchOptions, isReferrable: true)
In your Activity source file, e.g. MainActivity.java, before calling RNBranch.initSession()
,
call RNBranch.setDebug()
:
RNBranchModule.setDebug();
RNBranchModule.initSession(getIntent().getData(), this);