|
53 | 53 | + [Redeem rewards](#redeem-all-or-some-of-the-reward-balance-store-state) |
54 | 54 | + [Get credit history](#get-credit-history) |
55 | 55 |
|
| 56 | +6. General support |
| 57 | + + [Troubleshooting](#troubleshooting) |
| 58 | + |
56 | 59 | ## Installation |
57 | 60 |
|
58 | 61 | Note that the `react-native-branch` module requires `react-native` >= 0.40. |
@@ -1163,3 +1166,93 @@ See also [Deep Link Routing](https://dev.branch.io/getting-started/deep-link-rou |
1163 | 1166 | on the Branch documentation site for more information. |
1164 | 1167 |
|
1165 | 1168 | Any additional data attached to the Branch link will be available unprefixed. |
| 1169 | + |
| 1170 | +___ |
| 1171 | + |
| 1172 | +## Troubleshooting |
| 1173 | + |
| 1174 | +### Example apps for testing |
| 1175 | + |
| 1176 | +See the [examples](./examples) folder for a number of example apps that demonstrate usage of the |
| 1177 | +SDK and can be used for testing. There is also a [tutorial app](./examples/webview_tutorial) that |
| 1178 | +walks you through integrating the Branch SDK step by step. |
| 1179 | + |
| 1180 | +### Simulate an install |
| 1181 | + |
| 1182 | +**Do not test in production.** |
| 1183 | + |
| 1184 | +This requires a native method call that must be made before JS has loaded. There are two options. |
| 1185 | + |
| 1186 | +1. Use a `branch.json` file with your project. See https://rnbranch.app.link/branch-json for full details. |
| 1187 | + Add `"debugMode": true` to `branch.debug.json`: |
| 1188 | + |
| 1189 | + ```json |
| 1190 | + { |
| 1191 | + "appleSearchAdsDebugMode": true, |
| 1192 | + "debugMode": true, |
| 1193 | + "delayInitToCheckForSearchAds": true |
| 1194 | + } |
| 1195 | + ``` |
| 1196 | + |
| 1197 | + Do not add this setting to `branch.json`, or it will be enabled for release builds. |
| 1198 | + |
| 1199 | +2. Modify your native app code. |
| 1200 | + |
| 1201 | + **Android** |
| 1202 | + |
| 1203 | + Simulated installs may be enabled on Android by adding `<meta-data android:name="io.branch.sdk.TestMode" android:value="true"/>` to the `application` element of your Android manifest. Use this in a build type |
| 1204 | + such as `debug` or a product flavor, or be sure to remove it from your manifest before releasing to prod. |
| 1205 | + See https://docs.branch.io/pages/apps/android/#simulate-an-install for full details. |
| 1206 | + |
| 1207 | + Alternately, add `RNBranchModule.setDebug();` in your MainActivity before the call to `initSession`. Be sure to remove it |
| 1208 | + before releasing to prod. |
| 1209 | + |
| 1210 | + ```java |
| 1211 | + // Remove before prod release |
| 1212 | + RNBranchModule.setDebug(); |
| 1213 | + RNBranchModule.initSession(getIntent().getData(), this); |
| 1214 | + ``` |
| 1215 | + |
| 1216 | + **iOS** |
| 1217 | + |
| 1218 | + Add `[RNBranch setDebug];` or `RNBranch.setDebug()` in your AppDelegate before the call to `initSession`. |
| 1219 | + Use conditional compilation or remove before releasing to prod. |
| 1220 | + |
| 1221 | + _Swift_ |
| 1222 | + ```Swift |
| 1223 | + #if DEBUG |
| 1224 | + RNBranch.setDebug() |
| 1225 | + #endif |
| 1226 | + RNBranch.initSession(launchOptions: launchOptions, isReferrable: true) |
| 1227 | + ``` |
| 1228 | + |
| 1229 | + _Objective-C_ |
| 1230 | + ```Objective-C |
| 1231 | + #ifdef DEBUG |
| 1232 | + [RNBranch setDebug]; |
| 1233 | + #endif |
| 1234 | + [RNBranch initSessionWithLaunchOptions:launchOptions isReferrable:YES]; |
| 1235 | + ``` |
| 1236 | + |
| 1237 | +### Using getLatestReferringParams to handle link opens |
| 1238 | + |
| 1239 | +The `getLatestReferringParams` method is essentially a synchronous method that retrieves the latest |
| 1240 | +referring link parameters stored by the native SDK. However, React Native does not support synchronous |
| 1241 | +calls to native code from JavaScript, so the method returns a promise. You must `await` the response |
| 1242 | +or use `then` to receive the result. The same remarks apply to the `getFirstReferringParams` method. |
| 1243 | +However, this is only a restriction of React Native. The purpose of `getLatestReferringParams` is to |
| 1244 | +retrieve those parameters one time. The promise will only return one result. It will not continue |
| 1245 | +to return results when links are opened or wait for a link to be opened. This method is not intended |
| 1246 | +to notify the app when a link has been opened. |
| 1247 | + |
| 1248 | +To receive notification whenever a link is opened, _including at app launch_, call |
| 1249 | +`branch.subscribe`. The callback to this method will return any initial link that launched the |
| 1250 | +app and all subsequent link opens. There is no need to call `getLatestReferringParams` at app |
| 1251 | +launch to check for an initial link. Use `branch.subscribe` to handle all link opens. |
| 1252 | + |
| 1253 | +### General troubleshooting |
| 1254 | + |
| 1255 | +See the troubleshooting guide for each native SDK: |
| 1256 | + |
| 1257 | +- [iOS](https://docs.branch.io/pages/apps/ios/#troubleshoot-issues) |
| 1258 | +- [Android](https://docs.branch.io/pages/apps/android/#troubleshoot-issues) |
0 commit comments