npm install --save react-native-branchrnpm link react-native-branchor link the project manually- Add
pod 'Branch'as a dependency in your ios/Podfile cd ios && pod install
In a standard installation your Podfile should look something like:
target 'MyProject' do
pod 'Branch'
end
If you do not already have a Podfile in your ios directory, you can create one with cd ios && pod init. Then add pod 'Branch' to your target. The final Podfile should look something like:
target 'MyProject' do
pod 'Branch'
end
Now run pod install to get the branch sdk.
After pod install you will from now on need to open your project using [MyProject].xcworkspace instead of the old .xcodeproj.
If you already use the React cocoa-pod, you can simply add the react-native-branch dependency to your Podfile:
target 'MyProject' do
pod 'React', :path => '../node_modules/react-native'
pod 'react-native-branch', :path => '../node_modules/react-native-branch'
end
- Drag and Drop /node_modules/react-native-branch/RNBranch/RNBranch.xcodeproj into the Libraries folder of your project in XCode (as described in Step 1 here)
- Drag and Drop the RNBranch.xcodeproj's Products's libRNBranch.a into your project's target's "Linked Frameworks and Libraries" section (as described in Step 2 here)
- Add "$(SRCROOT)/../node_modules/react-native-branch/ios" to your project's Build Settings -> Header Search Paths (as described in Step 3 here)
android/settings.gradle
include ':react-native-branch', ':app'
project(':react-native-branch').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-branch/android')android/app/build.gradle
dependencies {
...
compile project(':react-native-branch')
}Now that branch is installed, you will need to set up your app to handle branch links.