react-native-branch-deep-linking-attribution
react-native-branch-deep-linking-attribution copied to clipboard
No known class method for selector 'checkPasteboardOnInstall' when implementing Nativelink (5.0.4)
A few days ago I received an email regarding the iOS 15 privacy and that Branch.io has released the NativeLink.
After upgrading the react-native-branch package to 5.0.4 and adding [RNBranch checkPasteboardOnInstall]; to my AppDelegate.m file I cannot build my app.
In Xcode i am getting the error that No known class method for selector 'checkPasteboardOnInstall'.
Steps:
- bump react-native-branch version from 5.0.0 to 5.0.4
- run
yarn install - run
pod installin the ios directory - Open xCode and add
[RNBranch checkPasteboardOnInstall];to the AppDelegate.m - Run Product -> Clean and Product -> Clean build folder
- Build in Xcode
Code:
#import <RNBranch/RNBranch.h>
// ....
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[AppCenterReactNative register];
[AppCenterReactNativeAnalytics registerWithInitiallyEnabled:true];
[AppCenterReactNativeCrashes registerWithAutomaticProcessing];
[GMSServices provideAPIKey:@"__________________"];
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryAmbient error:nil]; // allow
// https://github.com/react-native-video/react-native-video#audio-mixing
#ifdef FB_SONARKIT_ENABLED
InitializeFlipper(application);
#endif
if ([[[UIDevice currentDevice] systemVersion] compare:@"15.0" options:NSNumericSearch] != NSOrderedAscending)
[RNBranch checkPasteboardOnInstall];
[RNBranch initSessionWithLaunchOptions:launchOptions isReferrable:YES ];
RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
moduleName:@"______"
initialProperties:nil];
rootView.backgroundColor = [UIColor colorWithRed:0.13 green:0.14 blue:0.14 alpha:1.00];
[ParalenzUtils showSplashScreen:@"LaunchScreen" inRootView:rootView];
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
UIViewController *rootViewController = [UIViewController new];
rootViewController.view = rootView;
self.window.rootViewController = rootViewController;
self.rootViewController = rootViewController;
[Orientation setOrientation:UIInterfaceOrientationMaskPortrait];
[self.window makeKeyAndVisible];
return YES;
}
React native env:
System:
OS: macOS 11.4
CPU: (8) x64 Intel(R) Core(TM) i5-1038NG7 CPU @ 2.00GHz
Memory: 727.19 MB / 16.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 16.6.1 - /usr/local/bin/node
Yarn: 1.22.10 - /usr/local/bin/yarn
npm: 7.20.3 - /usr/local/bin/npm
Watchman: 2021.06.07.00 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.10.1 - /Users/___/.rvm/gems/ruby-2.7.2/bin/pod
SDKs:
iOS SDK:
Platforms: iOS 14.5, DriverKit 20.4, macOS 11.3, tvOS 14.5, watchOS 7.4
Android SDK:
API Levels: 28, 30
Build Tools: 29.0.2, 29.0.3, 30.0.3
System Images: android-30 | Google APIs Intel x86 Atom
Android NDK: Not Found
IDEs:
Android Studio: 4.2 AI-202.7660.26.42.7351085
Xcode: 12.5.1/12E507 - /usr/bin/xcodebuild
Languages:
Java: 1.8.0_282 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 17.0.1 => 17.0.1
react-native: 0.64.2 => 0.64.2
react-native-macos: Not Found
npmGlobalPackages:
*react-native*: Not Found
Could the maintainers please advice on what I've done incorrectly.
Thanks in advance
@arelstone
Apologies, the line for editing the AppDelegate on React Native should have been as follows. [RNBranch.branch checkPasteboardOnInstall];
I'll update the release notes.
I had assumed most were using branch.json to configure it, but that seems to have been an incorrect assumption. I
Moving [RNBranch.branch checkPasteboardOnInstall]; to the line below [RNBranchinitSessionWithLaunchOptions:launchOptions isReferrable:YES]; worked. Thanks a lot for the fast response. 🎉 🏅
@echo-branch I have a branch.json-file in the project. Will that be enough?
I have a few questions. Maybe I can find answers to my questions in the documentation, but I'll ask them anyways, hope that will be okay with you.
Will it be possible for me to remove [RNBranch initSessionWithLaunchOptions:launchOptions isReferrable:YES]; from the AppDelegate.m and rely on branch.json? Would relying on branch.json, be enough? The reason for me asking is that the native side of RN, is to be honest, not my strong side and I'd like to keep things as much as possible in the javascript layer.
Unfortunately no. We don't do any swizzling to intercept low level calls, so we still need developers to add those few lines to the AppDelegate. The branch.json is more for config.
Thanks for the answer @echo-branch. Form my point of view, this issue can be closed. Thanks for the answer
Could you please also update the RN Branch docs here: https://help.branch.io/developers-hub/docs/react-native#nativelink-deferred-deep-linking-ios-only
Right now they just say to follow the iOS docs, which is inaccurate.
Thanks!
@aparedes-branch Let's clarify the docs on RN a bit, seems we left off an important bit.
Looks like those docs still need updating, FYI!
Thanks for bumping this! We've updated it here https://help.branch.io/developers-hub/docs/react-native#nativelink-deferred-deep-linking
If you see errors or inaccuracies feel free to Suggest Edits and we'll approve/modify them.
Thanks!