invertase / react-native-firebase

🔥 A well-tested feature-rich modular Firebase implementation for React Native. Supports both iOS & Android platforms for all Firebase services.
https://rnfirebase.io
Other
11.72k stars 2.22k forks source link

RNFirebase.dynamicLinks multilinks code example in documentation is wrong #2968

Closed BoKKeR closed 4 years ago

BoKKeR commented 4 years ago

Issue

I have been using firebase DynamicLinks to login but additionally I wanted to use deeplinks for invites using a custom deep link. I am guessing that I have to setup the "more than one link configuration" in the rnfirebase documentation but I cant compile my project with the following code that they provide: https://rnfirebase.io/docs/v5.x.x/links/ios image

but I am getting the following errors in xcode: image


Project Files

Javascript

Click To Expand

#### `package.json`: ```json { "name": "happyxApp", "version": "0.0.1", "private": true, "scripts": { "start": "node node_modules/react-native/local-cli/cli.js start", "test": "jest --detectOpenHandles", "update-snapshot": "jest --updateSnapshot", "lint": "eslint .", "create-component": "scripts/create-component/index.sh", "ios": "react-native run-ios", "ios11": "react-native run-ios --simulator=\"iPhone 11\"", "android": "react-native run-android", "fix-modal": "node node_modules/react-native-modal-translucent/scripts/translucent-modal.js", "postinstall": "npm run fix-modal && npx jetify", "setup:prod": "./setupEnvironment.sh prod" }, "dependencies": { "@sentry/react-native": "^1.1.0", "@types/uuid": "^3.4.6", "axios": "^0.18.0", "dinero.js": "^1.6.0", "formik": "^1.5.8", "intl": "^1.2.5", "jetifier": "^1.6.4", "moment": "^2.24.0", "react": "16.8.3", "react-art": "^16.8.6", "react-dom": "^16.8.6", "react-elements": "^1.3.1", "react-native": "0.59.10", "react-native-action-button": "^2.8.5", "react-native-calendars": "^1.136.0", "react-native-config": "^0.11.7", "react-native-easy-toast": "^1.2.0", "react-native-elements": "^1.1.0", "react-native-fast-image": "^6.0.3", "react-native-firebase": "^5.5.6", "react-native-floating-action": "^1.19.1", "react-native-gesture-handler": "~1.4.0", "react-native-gifted-chat": "^0.9.11", "react-native-image-crop-picker": "^0.24.1", "react-native-image-resizer": "^1.0.1", "react-native-iphone-x-helper": "^1.2.1", "react-native-linear-gradient": "^2.5.4", "react-native-modal": "^11.5.3", "react-native-modal-datetime-picker": "^7.6.0", "react-native-modal-selector": "^1.1.1", "react-native-modal-translucent": "^4.0.0", "react-native-status-bar-height": "^2.4.0", "react-native-uuid-generator": "^6.1.1", "react-native-vector-icons": "^6.4.2", "react-native-wheel-picker": "^1.2.0", "react-navigation": "^3.6.0", "react-navigation-tabs": "^2.5.6", "react-navigation-transitions": "^1.0.12", "react-redux": "^6.0.1", "redux": "^4.0.1", "redux-devtools-extension": "^2.13.8", "redux-persist": "^5.10.0", "redux-thunk": "^2.3.0", "styled-components": "^4.3.2", "toggle-switch-react-native": "^2.0.2", "uuid": "^3.3.3", "yup": "^0.27.0" }, "devDependencies": { "@babel/core": "^7.4.5", "@babel/runtime": "^7.4.5", "@react-native-community/async-storage": "^1.5.0", "@react-native-community/eslint-config": "^0.0.3", "@types/dinero.js": "^1.4.1", "@types/enzyme": "^3.9.4", "@types/enzyme-adapter-react-16": "^1.0.5", "@types/jest": "^24.0.11", "@types/moment": "^2.13.0", "@types/react": "^16.8.10", "@types/react-native": "^0.57.42", "@types/react-native-calendars": "^1.20.5", "@types/react-native-vector-icons": "^6.4.1", "@types/react-navigation": "^3.0.6", "@types/react-redux": "^7.0.6", "@types/react-test-renderer": "^16.8.1", "@types/redux-persist": "^4.3.1", "@types/yup": "^0.26.22", "babel-jest": "^24.8.0", "enzyme": "^3.10.0", "enzyme-adapter-react-16": "^1.14.0", "enzyme-to-json": "^3.3.5", "eslint": "^5.16.0", "jest": "^24.8.0", "jest-mock-axios": "^3.0.0", "metro-react-native-babel-preset": "^0.54.1", "moxios": "^0.4.0", "react-native-typescript-transformer": "^1.2.12", "react-test-renderer": "16.8.3", "redux-mock-store": "^1.5.3", "ts-jest": "^24.0.2", "tslint": "^5.18.0", "tslint-config-airbnb": "^5.11.1", "tslint-config-prettier": "^1.18.0", "tslint-react": "^4.0.0", "typescript": "^3.4.1" }, "rnpm": { "assets": [ "./app/assets/fonts/" ] } } ``` #### `firebase.json` for react-native-firebase v6: ```json # N/A ``` ### iOS

Click To Expand

#### `ios/Podfile`: - [ ] I'm not using Pods - [x] I'm using Pods and my Podfile looks like: ```ruby # N/A ``` #### `AppDelegate.m`: ```objc /** * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ #import #import "AppDelegate.h" #import "RNFirebaseLinks.h" #import #import #import #import #import "SDImageCodersManager.h" #import @implementation AppDelegate - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary *)options { BOOL handled = [RCTLinkingManager application:application openURL:url sourceApplication:sourceApplication annotation:annotation]; if (!handled) { handled = [[RNFirebaseLinks instance] application:application openURL:url options:options]; } return handled; } - (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray *))restorationHandler { BOOL handled = [RCTLinkingManager application:application continueUserActivity:userActivity restorationHandler:restorationHandler]; if (!handled) { handled = [[RNFirebaseLinks instance] application:application continueUserActivity:userActivity restorationHandler:restorationHandler]; } return handled; } - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [FIROptions defaultOptions].deepLinkURLScheme = @"happyx.page.link"; [FIRApp configure]; [FIRDatabase database].persistenceEnabled = YES; RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions]; RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge moduleName:@"happyxApp" initialProperties:nil]; rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1]; self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; UIViewController *rootViewController = [UIViewController new]; rootViewController.view = rootView; self.window.rootViewController = rootViewController; [self.window makeKeyAndVisible]; // Register WebP format support [SDImageCodersManager.sharedManager addCoder:SDImageWebPCoder.sharedCoder]; return YES; } - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge { #if DEBUG return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil]; #else return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; #endif } @end ```

--- ### Android
Click To Expand

#### Have you converted to AndroidX? - [X] my application is an AndroidX application? - [X] I am using `android/gradle.settings` `jetifier=true` for Android compatibility? - [X] I am using the NPM package `jetifier` for react-native compatibility? #### `android/build.gradle`: ```groovy // N/A ``` #### `android/app/build.gradle`: ```groovy // N/A ``` #### `android/settings.gradle`: ```groovy // N/A ``` #### `MainApplication.java`: ```java // N/A ``` #### `AndroidManifest.xml`: ```xml ```

--- ## Environment
Click To Expand

**`react-native info` output:** ``` React Native Environment Info: System: OS: macOS 10.15.1 CPU: (12) x64 Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz Memory: 1.34 GB / 16.00 GB Shell: 5.7.1 - /bin/zsh Binaries: Node: 10.15.3 - /usr/local/bin/node npm: 6.12.0 - ~/.npm-packages/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman SDKs: iOS SDK: Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1 IDEs: Android Studio: 3.5 AI-191.8026.42.35.5900203 Xcode: 11.2/11B52 - /usr/bin/xcodebuild npmPackages: react: 16.8.3 => 16.8.3 react-native: 0.59.10 => 0.59.10 npmGlobalPackages: react-native-cli: 2.0.1 react-native-debugger-open: 0.3.22 ``` - **Platform that you're experiencing the issue on**: - [X] iOS - [ ] Android - [ ] **iOS** but have not tested behavior on Android - [ ] **Android** but have not tested behavior on iOS - [ ] Both - **`react-native-firebase` version you're using that has this issue:** - `5.5.6` - **`Firebase` module(s) you're using that has the issue:** - `'Firebase/DynamicLinks', '~> 6.3.0'` - **Are you using `TypeScript`?** - `Y` & `3.4.1` DynamicLinks

--- Think `react-native-firebase` is great? Please consider supporting all of the project maintainers and contributors by donating via our [Open Collective](https://opencollective.com/react-native-firebase/donate) where all contributors can submit expenses. [[Learn More]](https://invertase.io/oss/react-native-firebase/contributing/donations-expenses) - 👉 Check out [`React Native Firebase`](https://twitter.com/rnfirebase) and [`Invertase`](https://twitter.com/invertaseio) on Twitter for updates on the library.
BoKKeR commented 4 years ago

I have managed to get it to work using this code on iphones that are not running iOS 13.2 and are not in debug mode. Which barely covers any use case at all

/**
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */
#import "AppDelegate.h"
#import <Firebase.h>
#import "RNFirebaseLinks.h"
#import <React/RCTLinkingManager.h>
#import <React/RCTBridge.h>
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
#import "SDImageCodersManager.h"
#import <SDWebImageWebPCoder/SDImageWebPCoder.h>
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  [FIROptions defaultOptions].deepLinkURLScheme = @"projectlunch.page.link";
  [FIRApp configure];
  [SDImageCodersManager.sharedManager addCoder:SDImageWebPCoder.sharedCoder];
  RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
  RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
                                                   moduleName:@"lunch"
                                            initialProperties:nil];
  rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];
  self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
  UIViewController *rootViewController = [UIViewController new];
  rootViewController.view = rootView;
  self.window.rootViewController = rootViewController;
  [self.window makeKeyAndVisible];
  return YES;
}
- (BOOL)application:(UIApplication *)application
            openURL:(NSURL *)url
            options:(NSDictionary<NSString *, id> *)options {
    BOOL handled = [RCTLinkingManager application:application openURL:url options:options];
    if (!handled) {
     handled = [[RNFirebaseLinks instance] application:application openURL:url options:options];
    }
    return handled;
}
- (BOOL)application:(UIApplication *)application
continueUserActivity:(NSUserActivity *)userActivity
 restorationHandler:(void (^)(NSArray *))restorationHandler {
     return [[RNFirebaseLinks instance] application:application continueUserActivity:userActivity restorationHandler:restorationHandler];
}
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
#if DEBUG
  return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
#else
  return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
#endif
}
@end
mikehardy commented 4 years ago

Sorry for the delay However, you should check the compatibility matrix in the getting started page on rnfirebase.io

On ios13 you must use pods 6.5+ or there are possible crashes. And really, pods 6.13.0 are current, I'd upgrade to those.

I don't think ios13 was even in beta when 6.3.0 was released so expecting it to work is low-probability success. Running pod outdated periodically and staying up to date is important, in consultation with compatibility matrix and release notes here in react-native-firebase

stale[bot] commented 4 years ago

Hello 👋, to help manage issues we automatically close stale issues. This issue has been automatically marked as stale because it has not had activity for quite some time. Has this issue been fixed, or does it still require the community's attention?

This issue will be closed in 15 days if no further activity occurs. Thank you for your contributions.

BoKKeR commented 4 years ago

That is true but the documentation has wrong code that does not work out of the box

mikehardy commented 4 years ago

There is an edit link on the top right of every documentation page and docs PRs are always appreciated 🙏

stale[bot] commented 4 years ago

Hello 👋, to help manage issues we automatically close stale issues. This issue has been automatically marked as stale because it has not had activity for quite some time. Has this issue been fixed, or does it still require the community's attention?

This issue will be closed in 15 days if no further activity occurs. Thank you for your contributions.

stale[bot] commented 4 years ago

Closing this issue after a prolonged period of inactivity. If this is still present in the latest release, please feel free to create a new issue with up-to-date information.