Initial SDK Setup
Installing the Braze SDK will provide you with analytics functionality, as well as push and in-app messages.
Step 1: Get the SDK
iOS with podspec
npm install react-native-appboy-sdk@latest --save
- Add
pod 'react-native-appboy-sdk', :path => '../node_modules/react-native-appboy-sdk'
to your app target in your Podfile. Note that the react-native-appboy-sdk
pod has a dependency on the React
pod.
- Run
pod install
from your ios
directory.
iOS without podspec
- Install the Braze iOS SDK into your iOS project. See instructions for CocoaPods here. For manual integration, please check here. See notes below for further information.
npm install react-native-appboy-sdk@latest --save
- In the Xcode’s “Project navigator”, right-click on your project’s Libraries folder ➜
Add Files to <...>
- Go to
node_modules
➜ react-native-appboy-sdk
➜ ios
➜ AppboyReactBridge
➜ select AppboyReactBridge.xcodeproj
- Add
libAppboyReactBridge.a
to Build Phases -> Link Binary With Libraries
- Update the ‘Header Search Paths’ in the AppboyReactBridge Xcode project to reference the headers directory of your installation of the Braze iOS SDK.
iOS Completing the Integration
- Complete your iOS SDK integration. You must pass your Braze API key to the SDK in
startWithApiKey
in your App delegate’s didFinishLaunchingWithOptions:
method. While custom endpoints are no longer assigned by Braze, if you have been given a pre-existing custom endpoint, you need to set up your custom endpoint in your Info.plist
file.
- When you need to make Braze calls from JavaScript, use the following declaration to import the JavaScript module:
1
| const ReactAppboy = require('react-native-appboy-sdk');
|
Note on Deep Links on iOS
For deep links to work on iOS from a cold start, you will need to add the following to your App delegate file’s didFinishLaunchingWithOptions
method:
1
| [[AppboyReactUtils sharedInstance] populateInitialUrlFromLaunchOptions:launchOptions];
|
1
| AppboyReactUtils.sharedInstance()?.populateInitialUrl(fromLaunchOptions: launchOptions)
|