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

Dynamic Links don't open the app in iOS #3755

Closed eraykose closed 4 years ago

eraykose commented 4 years ago

Issue

I followed the steps in the documentation. I checked all steps and configuration again. All looks fine. When i build the app to my real device, i click the link and link never open the app. It just go to web preview page and open the app store. I reboot phone uninstall app and build again but nothing change.


Project Files

Javascript

Click To Expand

#### `package.json`: ```json { "name": "catch-jobs", "version": "1.0.0", "description": "CatchJobs", "scripts": { "start": "react-native start", "android": "react-native run-android", "android:production": "ENVFILE=.env.production react-native run-android", "android:release:device": "ENVFILE=.env.test react-native run-android --variant=release", "android:release:device:production": "ENVFILE=.env.production react-native run-android --variant=release", "android:release:apk": "cd android && ENVFILE=.env.test ./gradlew assembleRelease", "android:release:apk:production": "cd android && ENVFILE=.env.production ./gradlew assembleRelease", "android:release:store": "cd android && ENVFILE=.env.production ./gradlew bundleRelease", "ios": "react-native run-ios", "ios:production": "ENVFILE=.env.production react-native run-ios", "debug": "open 'rndebugger://set-debugger-loc?host=localhost&port=8081'", "postinstall": "jetify", "lint": "eslint ." }, "repository": { "type": "git", "url": "git+https://github.com/cosan/catch-app.git" }, "dependencies": { "@react-native-community/async-storage": "^1.10.0", "@react-native-community/datetimepicker": "^2.3.2", "@react-native-community/google-signin": "^4.0.3", "@react-native-community/masked-view": "^0.1.10", "@react-native-community/slider": "^2.0.9", "@react-native-firebase/analytics": "^7.1.3", "@react-native-firebase/app": "^7.2.0", "@react-native-firebase/crashlytics": "^7.1.4", "@react-native-firebase/dynamic-links": "^7.1.3", "@react-navigation/bottom-tabs": "^5.5.1", "@react-navigation/native": "^5.5.0", "@react-navigation/stack": "^5.4.1", "axios": "^0.19.2", "babel-plugin-transform-remove-console": "^6.9.4", "expo-asset": "~8.1.4", "expo-constants": "~9.0.0", "expo-font": "~8.1.1", "expo-intent-launcher": "~8.1.0", "expo-keep-awake": "^8.1.0", "expo-linear-gradient": "~8.1.0", "expo-localization": "~8.1.0", "expo-location": "~8.1.0", "expo-permissions": "~8.1.0", "i18next": "^19.4.4", "immer": "^6.0.5", "immutable": "^4.0.0-rc.12", "moment": "^2.25.3", "prop-types": "15.7.2", "query-string": "6.12.1", "react": "16.13.1", "react-i18next": "^11.4.0", "react-native": "^0.62.2", "react-native-camera": "^3.24.1", "react-native-config": "^1.0.0", "react-native-confirmation-code-field": "6.0.3", "react-native-create-thumbnail": "^1.1.1", "react-native-document-picker": "^3.4.0", "react-native-fbsdk": "^2.0.0", "react-native-flipper": "^0.39.0", "react-native-fs": "^2.16.6", "react-native-gesture-handler": "^1.6.1", "react-native-image-crop-picker": "^0.31.1", "react-native-inappbrowser-reborn": "^3.4.0", "react-native-indicators": "^0.17.0", "react-native-keyboard-aware-scroll-view": "^0.9.1", "react-native-maps": "0.27.1", "react-native-masked-text": "^1.13.0", "react-native-orientation-locker": "^1.1.8", "react-native-picker-select": "^7.0.0", "react-native-reanimated": "1.8.0", "react-native-render-html": "^4.2.0", "react-native-safe-area-context": "^2.0.0", "react-native-screens": "^2.7.0", "react-native-slider": "^0.11.0", "react-native-splash-screen": "^3.2.0", "react-native-svg": "^12.1.0", "react-native-unimodules": "~0.9.1", "react-native-vector-icons": "^6.6.0", "react-native-video": "4.4.5", "react-native-webview": "^9.4.0", "react-redux": "^7.2.0", "redux": "^4.0.5", "redux-logger": "^3.0.6", "redux-thunk": "^2.3.0", "rn-actionsheet-module": "^1.0.3", "rn-redux-middleware-flipper": "^0.1.0" }, "devDependencies": { "@babel/core": "^7.9.6", "@babel/runtime": "^7.9.6", "@react-native-community/eslint-config": "^1.1.0", "babel-jest": "^26.0.1", "babel-plugin-module-resolver": "^4.0.0", "eslint": "^7.0.0", "jest": "^26.0.1", "metro-react-native-babel-preset": "^0.59.0", "react-native-svg-transformer": "^0.14.3", "react-test-renderer": "16.13.1" }, "author": "Eray Köse", "homepage": "https://www.catch.jobs" } ``` #### `firebase.json` for react-native-firebase v6: ```json { "react-native": { "crashlytics_auto_collection_enabled": true } } ```

iOS

Click To Expand

#### `ios/Podfile`: - [] I'm not using Pods - [x] I'm using Pods and my Podfile looks like: ```ruby platform :ios, '10.0' require_relative '../node_modules/react-native-unimodules/cocoapods' require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules' def add_flipper_pods!(versions = {}) versions['Flipper'] ||= '~> 0.33.1' versions['DoubleConversion'] ||= '1.1.7' versions['Flipper-Folly'] ||= '~> 2.1' versions['Flipper-Glog'] ||= '0.3.6' versions['Flipper-PeerTalk'] ||= '~> 0.0.4' versions['Flipper-RSocket'] ||= '~> 1.0' pod 'FlipperKit', versions['Flipper'], :configuration => 'Debug' pod 'FlipperKit/FlipperKitLayoutPlugin', versions['Flipper'], :configuration => 'Debug' pod 'FlipperKit/SKIOSNetworkPlugin', versions['Flipper'], :configuration => 'Debug' pod 'FlipperKit/FlipperKitUserDefaultsPlugin', versions['Flipper'], :configuration => 'Debug' pod 'FlipperKit/FlipperKitReactPlugin', versions['Flipper'], :configuration => 'Debug' # List all transitive dependencies for FlipperKit pods # to avoid them being linked in Release builds pod 'Flipper', versions['Flipper'], :configuration => 'Debug' pod 'Flipper-DoubleConversion', versions['DoubleConversion'], :configuration => 'Debug' pod 'Flipper-Folly', versions['Flipper-Folly'], :configuration => 'Debug' pod 'Flipper-Glog', versions['Flipper-Glog'], :configuration => 'Debug' pod 'Flipper-PeerTalk', versions['Flipper-PeerTalk'], :configuration => 'Debug' pod 'Flipper-RSocket', versions['Flipper-RSocket'], :configuration => 'Debug' pod 'FlipperKit/Core', versions['Flipper'], :configuration => 'Debug' pod 'FlipperKit/CppBridge', versions['Flipper'], :configuration => 'Debug' pod 'FlipperKit/FBCxxFollyDynamicConvert', versions['Flipper'], :configuration => 'Debug' pod 'FlipperKit/FBDefines', versions['Flipper'], :configuration => 'Debug' pod 'FlipperKit/FKPortForwarding', versions['Flipper'], :configuration => 'Debug' pod 'FlipperKit/FlipperKitHighlightOverlay', versions['Flipper'], :configuration => 'Debug' pod 'FlipperKit/FlipperKitLayoutTextSearchable', versions['Flipper'], :configuration => 'Debug' pod 'FlipperKit/FlipperKitNetworkPlugin', versions['Flipper'], :configuration => 'Debug' end # Post Install processing for Flipper def flipper_post_install(installer) installer.pods_project.targets.each do |target| target.build_configurations.each do |config| if target.name == 'YogaKit' config.build_settings['SWIFT_VERSION'] = '4.1' end # Change to target of production packages if !target.name.include?('Flipper') config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '10.0' end end end file_name = Dir.glob("*.xcodeproj")[0] app_project = Xcodeproj::Project.open(file_name) app_project.native_targets.each do |target| target.build_configurations.each do |config| cflags = config.build_settings['OTHER_CFLAGS'] || '$(inherited) ' unless cflags.include? '-DFB_SONARKIT_ENABLED=1' puts 'Adding -DFB_SONARKIT_ENABLED=1 in OTHER_CFLAGS...' cflags << '-DFB_SONARKIT_ENABLED=1' end config.build_settings['OTHER_CFLAGS'] = cflags end app_project.save end installer.pods_project.save end target 'CatchJobs' do rnPrefix = "../node_modules/react-native" # React Native and its dependencies pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector" pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec" pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired" pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety" pod 'React', :path => '../node_modules/react-native/' pod 'React-Core', :path => '../node_modules/react-native/' pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules' pod 'React-Core/DevSupport', :path => '../node_modules/react-native/' pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS' pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation' pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob' pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image' pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS' pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network' pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings' pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text' pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration' pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/' pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact' pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi' pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor' pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector' pod 'ReactCommon/callinvoker', :path => "../node_modules/react-native/ReactCommon" pod 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon" pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga', :modular_headers => true pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec' pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec' pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec' # Other native modules # Automatically detect installed unimodules use_unimodules! use_native_modules! # Enables Flipper. # # Note that if you have use_frameworks! enabled, Flipper will not work and # you should disable these next few lines. add_flipper_pods! post_install do |installer| flipper_post_install(installer) end end ``` #### `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 #import #import #import "RNSplashScreen.h" #import #import #import // react-native-oientation-locker #import "Orientation.h" // Facebook SDK #import // Google SignIn #import #import #if DEBUG #import #import #import #import #import #import static void InitializeFlipper(UIApplication *application) { FlipperClient *client = [FlipperClient sharedClient]; SKDescriptorMapper *layoutDescriptorMapper = [[SKDescriptorMapper alloc] initWithDefaults]; [client addPlugin:[[FlipperKitLayoutPlugin alloc] initWithRootNode:application withDescriptorMapper:layoutDescriptorMapper]]; [client addPlugin:[[FKUserDefaultsPlugin alloc] initWithSuiteName:nil]]; [client addPlugin:[FlipperKitReactPlugin new]]; [client addPlugin:[[FlipperKitNetworkPlugin alloc] initWithNetworkAdapter:[SKIOSNetworkAdapter new]]]; [client start]; } #endif @implementation AppDelegate @synthesize window = _window; // Facebook SDK - (void)applicationDidBecomeActive:(UIApplication *)application { [FBSDKAppEvents activateApp]; } - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { #if DEBUG InitializeFlipper(application); #endif if ([FIRApp defaultApp] == nil) { [FIRApp configure]; } self.moduleRegistryAdapter = [[UMModuleRegistryAdapter alloc] initWithModuleRegistryProvider:[[UMModuleRegistryProvider alloc] init]]; RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions]; RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge moduleName:@"CatchJobs" 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]; [RNSplashScreen show]; [super application:application didFinishLaunchingWithOptions:launchOptions]; // Facebook SDK [[FBSDKApplicationDelegate sharedInstance] application:application didFinishLaunchingWithOptions:launchOptions]; return YES; } // For URL open - (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary *)options { if ([[FBSDKApplicationDelegate sharedInstance] application:app openURL:url options:options]) { return YES; } if ([RNGoogleSignin application:app openURL:url options:options]) { return YES; } if ([RCTLinkingManager application:app openURL:url options:options]) { return YES; } return NO; } - (NSArray> *)extraModulesForBridge:(RCTBridge *)bridge { NSArray> *extraModules = [_moduleRegistryAdapter extraModulesForBridge:bridge]; // You can inject any extra modules that you would like here, more information at: // https://facebook.github.io/react-native/docs/native-modules-ios.html#dependency-injection return extraModules; } - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge { #if DEBUG return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil]; #else return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; #endif } // react-native-oientation-locker - (UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window { return [Orientation getOrientation]; } @end ```


Environment

Click To Expand

**`react-native info` output:** ``` System: OS: macOS 10.15.5 CPU: (8) x64 Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz Memory: 463.71 MB / 16.00 GB Shell: 5.7.1 - /bin/zsh Binaries: Node: 10.15.3 - /usr/local/bin/node Yarn: 1.22.0 - /usr/local/bin/yarn npm: 6.4.1 - /usr/local/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman Managers: CocoaPods: 1.8.4 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: iOS 13.4, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2 Android SDK: API Levels: 23, 26, 28 Build Tools: 28.0.3, 29.0.2 System Images: android-28 | Google Play Intel x86 Atom, android-29 | Google APIs Intel x86 Atom Android NDK: Not Found IDEs: Android Studio: 3.5 AI-191.8026.42.35.6010548 Xcode: 11.4/11E146 - /usr/bin/xcodebuild Languages: Java: 1.8.0_242 - /usr/bin/javac Python: 2.7.16 - /usr/bin/python npmPackages: @react-native-community/cli: Not Found react: 16.13.1 => 16.13.1 react-native: ^0.62.2 => 0.62.2 npmGlobalPackages: *react-native*: Not Found ``` - **Platform that you're experiencing the issue on**: - [x] iOS - [ ] Android - [x] **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:** - `7.2.0` - **`Firebase` module(s) you're using that has the issue:** - `e.g. Instance ID` - **Are you using `TypeScript`?** - `N`


XCode and firebase dynamic link Configurations

Screen Shot 2020-06-08 at 13 36 18 Screen Shot 2020-06-08 at 13 35 25 Screen Shot 2020-06-08 at 13 35 11

I am also getting the below log on XCode. I don't have any idea if it can be related with my problem

020-06-08 13:42:30.771644+0300 CatchJobs[3169:927221] Task <13870A10-DF70-4BF3-8E61-EA065F17DBB7>.<3> finished with error [-1003] Error Domain=NSURLErrorDomain Code=-1003 "Belirtilen ada sahip bir sunucu bulunamadı." UserInfo={NSUnderlyingError=0x2837c0390 {Error Domain=kCFErrorDomainCFNetwork Code=-1003 "(null)" UserInfo={_kCFStreamErrorCodeKey=8, _kCFStreamErrorDomainKey=12}}, NSErrorFailingURLStringKey=https://firebasedynamiclinks-ipv6.googleapis.com/v1/installAttribution?key=AIzaSyBXVgUDPXjVu7eGgeIX739s1WAP9tmwvYk, NSErrorFailingURLKey=https://firebasedynamiclinks-ipv6.googleapis.com/v1/installAttribution?key=AIzaSyBXVgUDPXjVu7eGgeIX739s1WAP9tmwvYk, _kCFStreamErrorDomainKey=12, _kCFStreamErrorCodeKey=8, NSLocalizedDescription=Belirtilen ada sahip bir sunucu bulunamadı.}
2020-06-08 13:42:31.232232+0300 CatchJobs[3169:927214] 6.25.0 - [Firebase/Analytics][I-ACS023001] Deep Link does not contain valid required params. URL params: {
    dismiss = 1;
    "is_weak_match" = 1;
}
mikehardy commented 4 years ago

"Belirtilen ada sahip bir sunucu bulunamadı." So it can't find the domain name somehow? Does seem related.

eraykose commented 4 years ago

@mikehardy thanks for comment mike. I found the solution. It is my bad. I just added Associated Domain only the Release target without checking it. However I was working on Debug target, so if anyone has the same problem, I recommend checking if it is added to all types of targets.

mikehardy commented 4 years ago

Glad it's working! iOS setup for all the various firebase features is kind of crazy, easy to miss things

duylinhdang1998 commented 2 years ago

@eraykose hello I have same issue? How I can fix that. I don't understand

manhhoan76 commented 2 years ago

Screen Shot 2022-09-15 at 09 58 43 @duylinhdang1998 It means, you must check the correct target in your project.