Skip to content

Dynamic links on IOS not working #3450

@TalEliel

Description

@TalEliel

Issue

Describe your issue here
Hey, I have been trying to use dynamic links in my app and ran into an issue on IOS where the dynamicLinks().getInitialLink() always returns null and the dynamicLinks().onLink() is not called upon entering the app from dynamic link

Project Files

Javascript

Click To Expand

package.json:

  "dependencies": {
    "@react-native-community/async-storage": "1.6.2",
    "@react-native-community/google-signin": "4.0.0",
    "@react-native-community/masked-view": "0.1.6",
    "@react-native-community/netinfo": "4.4.0",
    "@react-native-firebase/app": "6.3.4",
    "@react-native-firebase/crashlytics": "6.3.4",
    "@react-native-firebase/dynamic-links": "6.3.4",
    "@react-native-firebase/messaging": "6.3.4",
    "amplitude-js": "5.8.0",
    "lottie-react-native": "3.3.2",
    "mobx": "5.15.2",
    "mobx-react": "6.1.5",
    "moment": "2.24.0",
    "react": "16.9.0",
    "react-native": "0.61.2",
    "react-native-agora": "2.9.1-alpha.3",
    "react-native-appsflyer": "5.1.3",
    "react-native-deep-link": "0.2.9",
    "react-native-device-info": "5.2.1",
    "react-native-gesture-handler": "1.5.3",
    "react-native-haptic-feedback": "1.8.2",
    "react-native-home-indicator": "0.2.5",
    "react-native-keep-awake": "4.0.0",
    "react-native-linear-gradient": "2.5.6",
    "react-native-onesignal": "3.4.2",
    "react-native-orientation": "3.1.3",
    "react-native-reanimated": "1.7.0",
    "react-native-safe-area-context": "0.6.2",
    "react-native-screens": "2.0.0-alpha.26",
    "react-native-video": "5.0.2",
    "react-native-webview": "7.4.2",
    "react-navigation": "4.0.10",
    "react-navigation-stack": "1.10.3",
    "react-navigation-tabs": "2.7.0",
    "react-navigation-transitions": "1.0.12",
    "self-adjusting-interval": "1.0.0"
  },
  "devDependencies": {
    "@babel/core": "7.6.4",
    "@babel/plugin-proposal-decorators": "7.8.3",
    "@babel/runtime": "7.6.3",
    "@react-native-community/eslint-config": "0.0.3",
    "babel-jest": "24.9.0",
    "eslint": "6.5.1",
    "jest": "24.9.0",
    "metro-react-native-babel-preset": "0.51.1",
    "react-test-renderer": "16.9.0"
  },
  "jest": {
    "preset": "react-native"
  },
  "rnpm": {
    "assets": [
      "./assets/fonts/"
    ]
  }
}

firebase.json for react-native-firebase v6:

# N/A

iOS

Click To Expand

ios/Podfile:

  • I'm not using Pods
  • I'm using Pods and my Podfile looks like:
platform :ios, '10.0'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

target 'jumper' do
  # Pods for jumper
  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/jscallinvoker', :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'

  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'

  pod 'react-native-orientation', :path => '../node_modules/react-native-orientation'

  pod 'react-native-webview', :path => '../node_modules/react-native-webview'

  pod 'react-native-netinfo', :path => '../node_modules/@react-native-community/netinfo'


  pod 'react-native-onesignal', :path => '../node_modules/react-native-onesignal'

  pod 'RNDeviceInfo', :path => '../node_modules/react-native-device-info'

  pod 'RNCAsyncStorage', :path => '../node_modules/@react-native-community/async-storage'

  pod 'react-native-home-indicator', :path => '../node_modules/react-native-home-indicator'

  pod 'RNReactNativeHapticFeedback', :path => '../node_modules/react-native-haptic-feedback'
  
  pod 'lottie-ios', :path => '../node_modules/lottie-ios'
  
  pod 'lottie-react-native', :path => '../node_modules/lottie-react-native'

  pod 'react-native-keep-awake', :path => '../node_modules/react-native-keep-awake'


  pod 'react-native-video', :path => '../node_modules/react-native-video'
  
  pod 'BVLinearGradient', :path => '../node_modules/react-native-linear-gradient'
  
  pod 'Firebase/Core'
  pod 'RNFBApp', :path => '../node_modules/@react-native-firebase/app'
  pod 'Firebase/Analytics'
  pod 'RNGoogleSignin', :path => '../node_modules/@react-native-community/google-signin'
  pod 'RNFBCrashlytics', :path => '../node_modules/@react-native-firebase/crashlytics'
  pod 'RNFBMessaging', :path => '../node_modules/@react-native-firebase/messaging'
  pod 'RNFBDynamicLinks', :path => '../node_modules/@react-native-firebase/dynamic-links'
  pod 'react-native-agora', :path => '../node_modules/react-native-agora'

  target 'jumperTests' do
    inherit! :search_paths
    # Pods for testing
  end

  use_native_modules!
end

target 'jumper-tvOS' do
  # Pods for jumper-tvOS

  target 'jumper-tvOSTests' do
    inherit! :search_paths
    # Pods for testing
  end

end

target 'OneSignalNotificationServiceExtension' do
  pod 'OneSignal', '>= 2.9.3', '< 3.0'
end

AppDelegate.m:

/**
 * 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 "Orientation.h"
#import <RNHomeIndicator.h>
#import <React/RCTBridge.h>
#import <React/RCTBundleURLProvider.h>
#import <React/RCTLinkingManager.h>
#import <React/RCTRootView.h>
@import UIKit;
@import Firebase;
@import AppsFlyerLib;

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  [application registerForRemoteNotifications];
  [FIRApp configure];
  RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
  RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
                                                   moduleName:@"jumper"
                                            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 = [HomeIndicatorViewController new];
  rootViewController.view = rootView;
  self.window.rootViewController = rootViewController;
  [self.window makeKeyAndVisible];
  return YES;
}

- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
#if DEBUG
  return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
#else
  return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
#endif
}
- (UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window {
    return [Orientation getOrientation];
}

- (BOOL)application:(UIApplication *)application
   openURL:(NSURL *)url
   options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options
{
  return [RCTLinkingManager application:application openURL:url options:options];
}
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken{
  [[AppsFlyerTracker sharedTracker] registerUninstall:deviceToken];
}
- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray<id<UIUserActivityRestoring>> * _Nullable))restorationHandler{
  return [RCTLinkingManager application:application continueUserActivity:userActivity restorationHandler:restorationHandler];
}
@end


Android

Click To Expand

Have you converted to AndroidX?

  • my application is an AndroidX application?
  • I am using android/gradle.settings jetifier=true for Android compatibility?
  • I am using the NPM package jetifier for react-native compatibility?

android/build.gradle:

// N/A

android/app/build.gradle:

// N/A

android/settings.gradle:

// N/A

MainApplication.java:

// N/A

AndroidManifest.xml:

<!-- N/A -->


Environment

Click To Expand

react-native info output:

System:
    OS: macOS Mojave 10.14.6
    CPU: (4) x64 Intel(R) Core(TM) i7-2677M CPU @ 1.80GHz
    Memory: 19.49 MB / 4.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 12.13.0 - /usr/local/bin/node
    npm: 6.12.0 - /usr/local/bin/npm
  SDKs:
    iOS SDK:
      Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
  IDEs:
    Xcode: 11.3.1/11C504 - /usr/bin/xcodebuild
  npmPackages:
    react: 16.9.0 => 16.9.0 
    react-native: 0.61.2 => 0.61.2 
  npmGlobalPackages:
    react-native-cli: 2.0.1
  • Platform that you're experiencing the issue on:
    • 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:
    • 6.3.4
  • Firebase module(s) you're using that has the issue:
    • dynamic links
  • Are you using TypeScript?
    • No


Metadata

Metadata

Labels

Type: StaleIssue has become stale - automatically added by Stale botplugin: linksFirebase Dynamic Linksresolution: needs-reproThis issue could not be reproduced or needs a repro provided.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions