- SDK Version: 42
- Platforms(Android/iOS/web/all): Android and iOS
I have a React Native project with managed workflow (Expo SDK 42, nodejs 12.13.0, npm 6.12.0). I installed expo-branch library.
(inside package.json) “expo-branch”: “~4.2.1”
I added configuration (api key) to app.json:
"ios": {
"config": {
"branch": {
"apiKey": "APP-ID-known-as-API-KEY"
}
},
"associatedDomains": [
"my.app.link",
"my-alternate.app.link"
],
},
"android": {
"config": {
"branch": {
"apiKey": "APP-ID-known-as-API-KEY"
}
},
"intentFilters": [
{
"autoVerify": true,
"action": "VIEW",
"data": {
"scheme": "https",
"host": "*my.app.link"
},
"category": [
"BROWSABLE",
"DEFAULT"
]
},
{
"autoVerify": true,
"action": "VIEW",
"data": {
"scheme": "https",
"host": "*my-alternate.app.link"
},
"category": [
"BROWSABLE",
"DEFAULT"
]
}
],
},
On Branch.io, we have links like:
my.app.link/campaign-name
I have built a standalone version for iOS since Branch does not work in Expo go client. I also logged the status to Sentry. Code inside App.tsx:
// Imports
import Constants from 'expo-constants';
import { Native as Sentry } from 'sentry-expo';
import Branch from 'expo-branch';
...
// Subscribe to Branch
const initBranch = async () => {
if (Constants.appOwnership === 'standalone') {
Sentry.captureMessage(`Branch Start`);
Branch.subscribe((bundle) => {
Sentry.captureMessage(`Branch Subscribed: ${JSON.stringify(bundle)}`);
if (bundle.params && !bundle.error) {
// `params` contains all the info about the link.
Sentry.captureMessage(`Params: ${bundle.params}`);
Sentry.captureMessage(`Params length: ${bundle.params.length}`);
Object.keys(bundle.params).forEach((element, index) => {
Sentry.captureMessage(`Params(${index}): ${element[0]} ${element[1]}`);
});
} else {
Sentry.captureMessage(`Branch Subscription Error: ${bundle.error}`);
}
});
Sentry.captureMessage(`Branch End`);
}
};
When I open the app on iOS simulator, on Sentry, I see those:
Branch Start
Branch Subscription Error: The network request was invalid.
Branch End
Problem is not with internet connection. I am trying to figure out what might be the cause of this invalid network request.
Diagnostics:
Expo CLI 4.13.0 environment info:
System:
OS: macOS 12.0.1
Shell: 5.8 - /bin/zsh
Binaries:
Node: 12.13.0 - /usr/local/bin/node
npm: 6.12.0 - /usr/local/bin/npm
Managers:
CocoaPods: 1.11.2 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 21.2, iOS 15.2, macOS 12.1, tvOS 15.2, watchOS 8.3
Android SDK:
API Levels: 31
Build Tools: 31.0.0
System Images: android-31 | Google APIs ARM 64 v8a, android-32 | Google Play ARM 64 v8a
IDEs:
Android Studio: 2020.3 AI-203.7717.56.2031.7784292
Xcode: 13.2/13C90 - /usr/bin/xcodebuild
npmPackages:
expo: ^42.0.0 => 42.0.4
react: 16.13.1 => 16.13.1
react-dom: 16.13.1 => 16.13.1
react-native: https://github.com/expo/react-native/archive/sdk-42.0.0.tar.gz => 0.63.2
react-native-web: ^0.17.1 => 0.17.5
npmGlobalPackages:
expo-cli: 4.13.0
Expo Workflow: managed