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