全新安装后,Firebase动态链接不起作用(iOS)

时间:2019-02-15 14:01:47

标签: ios objective-c firebase-dynamic-links react-native-firebase

我已经将应用程序推送到App Store和Google Play。在Android上,动态链接按预期运行。但是,当我单击IOS设备上的动态链接时,首先会看到预览页面,然后将我重定向到应用商店,但是在安装应用程序后,动态链接根本无法正常工作。但!如果我再次尝试打开动态链接->预览页面->“要打开应用程序名称”->它会打开应用程序->动态链接会按预期启动。因此,该问题仅在重新开始时发生。 URL类型正确(标识符和URL方案与我的捆绑软件ID相同)。关联域是applinks: myproject .page.link,所以也很好。我的团队ID与Firebase相匹配。

#import "AppDelegate.h"

#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
#import "RNSplashScreen.h"
#import <Firebase.h>
#import "RNFirebaseLinks.h"
#import "RNFirebaseNotifications.h"

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application
            openURL:(NSURL *)url
            options:(NSDictionary<NSString *, id> *)options {

  return [[RNFirebaseLinks instance] application:application openURL:url options:options];
}

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

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  [FIRApp configure];
  [FIROptions defaultOptions].deepLinkURLScheme = @"com.matcher.app";

  [Fabric.sharedSDK setDebug:YES];
  [RNFirebaseNotifications configure];
  NSURL *jsCodeLocation;
  jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];

  RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
                                                      moduleName:@"heavenrank"
                                               initialProperties:nil
                                                   launchOptions:launchOptions];
  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];
  [[UNUserNotificationCenter currentNotificationCenter] setDelegate:self];
  [RNSplashScreen show];
  return YES;
}

@end

Pod文件

platform :ios, '9.0'

target 'heavenrank' do
  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
  # use_frameworks!

  # Pods for heavenrank

  # Required by RNFirebase
  pod 'Firebase/Core', '~> 5.11.0'

  # [OPTIONAL PODS] - comment out pods for firebase products you won't be using.
  pod 'Firebase/AdMob', '~> 5.11.0'
  pod 'Firebase/Auth', '~> 5.11.0'
  pod 'Firebase/Core', '~> 5.11.0'
  pod 'Firebase/Database', '~> 5.11.0'
  pod 'Firebase/Functions', '~> 5.11.0'
  pod 'Firebase/DynamicLinks', '~> 5.11.0'
  pod 'Firebase/Firestore', '~> 5.11.0'
  # pod 'Firebase/Invites', '~> 5.11.0'
  pod 'Firebase/Messaging', '~> 5.11.0'
  pod 'Firebase/RemoteConfig', '~> 5.11.0'
  pod 'Firebase/Storage', '~> 5.11.0'
  pod 'Firebase/Performance', '~> 5.11.0'
  pod 'Fabric', '~> 1.7.13'
  pod 'Crashlytics', '~> 3.10.9'

end

0 个答案:

没有答案