React-native-branch-deep-linking-attribution: 'react-native-branch/RNBranch.h' file not found

Created on 3 Oct 2019  路  5Comments  路  Source: BranchMetrics/react-native-branch-deep-linking-attribution

React Native 0.61.1
platform :ios, '9.0' (not using use_frameworks)

yarn add react-native-branch (installs 4.2.1)
react-native link react-native-branch
cd ./ios; pod repo update; pod install

Open .workspace, clean project, add objective-C code inside AppDelegate.m

'react-native-branch/RNBranch.h' file not found while building

Most helpful comment

Ah I misunderstood your question. Thought you were talking about being available via pod.

#import <RNBranch/RNBranch.h>

All 5 comments

The import should be removed in newer react. React Native automatically handles it. Versions before 0.60 required it.

@echo-branch if I don't put #import <react-native-branch/RNBranch.h> at the top of my AppDelegate.m, I get: Use of undeclared identifier 'RNBranch' in the following code:

- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
    if (![RNBranch.branch application:app openURL:url options:options]) {
        // do other deep link routing for the Facebook SDK, Pinterest SDK, etc
    }
    return YES;
}

- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray *restorableObjects))restorationHandler {
    return [RNBranch continueUserActivity:userActivity];
}

Ah I misunderstood your question. Thought you were talking about being available via pod.

#import <RNBranch/RNBranch.h>

@felixchan I'm having the same issue, RN 61.3 and branch 4.1.0, did you find a solution to this?

just realised @echo-branch has provided the answer:

change the import to
#import <RNBranch/RNBranch.h>

Was this page helpful?
0 / 5 - 0 ratings