UNPKG

1.47 kBMarkdownView Raw
1The `setDebug` method exists in the underlying native SDKs and the documentation
2for the react-native-branch SDK. Unfortunately, it is not possible to
3implement it in JavaScript immediately because the native methods must be called
4before initializing the native SDKs. Currently, the native SDKs are initialized
5before the JavaScript loads. By the time a React Native app calls `setDebug`,
6it is too late to call it. This is likely to change in a future release.
7
8For now, it is necessary to make the call directly in native code on both
9platforms.
10
11As of 2.0.0-beta.7, it is also possible to call `setDebug` using the `debugMode`
12parameter in the `branch.json` configuration file. See
13https://rnbranch.app.link/branch-json for details.
14
15#### iOS
16
17##### Objective-C
18
19In AppDelegate.m, before calling `[RNBranch initSessionWithLaunchOptions:isReferrable:]`,
20call `[RNBranch setDebug]`.
21
22```Obj-C
23[RNBranch setDebug];
24[RNBranch initSessionWithLaunchOptions:launchOptions isReferrable:YES];
25```
26
27##### Swift
28
29In AppDelegate.swift, before calling `RNBranch.initSession(launchOptions:, isReferrable:)`,
30call `RNBranch.setDebug()`.
31
32```Swift
33RNBranch.setDebug()
34RNBranch.initSession(launchOptions: launchOptions, isReferrable: true)
35```
36
37#### Android
38
39In your Activity source file, e.g. MainActivity.java, before calling `RNBranch.initSession()`,
40call `RNBranch.setDebug()`:
41
42```Java
43RNBranchModule.setDebug();
44RNBranchModule.initSession(getIntent().getData(), this);
45```