0

我正在开发一个使用 Firebase 的应用程序。该应用程序是用 React-Native JS 编写的。

问题是:第一次启动应用程序时,它在尝试配置 Firebase 时崩溃。当我在崩溃后关闭应用程序并重新启动它(不卸载,只需重新启动它)它工作得很好。

有人可以帮忙吗?这是错误日志:

2018-08-02 16:40:29.345 CVJM[6670] <Warning> [Firebase/Analytics][I-ACS005000] The AdSupport Framework is not currently linked. Some features will not function properly. Learn more at ...
2018-08-02 16:40:29.348 CVJM[6670] <Notice> [Firebase/Analytics][I-ACS023007] Firebase Analytics v.4000000 started
2018-08-02 16:40:29.348 CVJM[6670] <Notice> [Firebase/Analytics][I-ACS023008] To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled (see ...)
=================================================================
Main Thread Checker: UI API called on a background thread: -[UIApplication delegate]
PID: 6670, TID: 499999, Thread name: (none), Queue name: FIRAnalyticsQueue, QoS: 9
Backtrace:
4   CVJM                                0x0000000102d8feb7 __38+[FIRAnalytics createAppDelegateProxy]_block_invoke + 55
5   libdispatch.dylib                   0x000000010a3777ec _dispatch_client_callout + 8
6   libdispatch.dylib                   0x000000010a378d64 dispatch_once_f + 285
7   CVJM                                0x0000000102d8e366 __47+[FIRAnalytics startWithConfiguration:options:]_block_invoke_2 + 101
8   libdispatch.dylib                   0x000000010a3767ab _dispatch_call_block_and_release + 12
9   libdispatch.dylib                   0x000000010a3777ec _dispatch_client_callout + 8
10  libdispatch.dylib                   0x000000010a37fbe5 _dispatch_queue_serial_drain + 1305
11  libdispatch.dylib                   0x000000010a3804fa _dispatch_queue_invoke + 328
12  libdispatch.dylib                   0x000000010a38336c _dispatch_root_queue_drain + 664
13  libdispatch.dylib                   0x000000010a383076 _dispatch_worker_thread3 + 132
14  libsystem_pthread.dylib             0x000000010a8a2169 _pthread_wqthread + 1387
15  libsystem_pthread.dylib             0x000000010a8a1be9 start_wqthread + 13
2018-08-02 16:40:29.797 CVJM[6670] <Notice> [Firebase/Messaging][I-FCM001000] FIRMessaging Remote Notifications proxy enabled, will swizzle remote notification receiver handlers. Add "FirebaseAppDelegateProxyEnabled" to your Info.plist and set it to NO
2018-08-02 16:40:29.870 CVJM[6670] <Notice> [Firebase/Analytics][I-ACS003007] Successfully created Firebase Analytics App Delegate Proxy automatically. To disable the proxy, set the flag FirebaseAppDelegateProxyEnabled to NO in the Info.plist
=================================================================
Main Thread Checker: UI API called on a background thread: -[UIApplication applicationState]
PID: 6670, TID: 499990, Thread name: (none), Queue name: com.google.fira.worker, QoS: 9
Backtrace:
4   CVJM                                0x0000000102d8dd76 FIRAIsAppActive + 55
5   CVJM                                0x0000000102d8d274 -[FIRASessionReporter shouldStartNewSession] + 19
6   CVJM                                0x0000000102d8ce4e -[FIRASessionReporter initWithPersistedConfig:] + 282
7   CVJM                                0x0000000102d77691 __48-[FIRAMeasurement startMeasurementOnWorkerQueue]_block_invoke + 1934
8   libdispatch.dylib                   0x000000010a3777ec _dispatch_client_callout + 8
9   libdispatch.dylib                   0x000000010a378d64 dispatch_once_f + 285
10  CVJM                                0x0000000102d76f01 -[FIRAMeasurement startMeasurementOnWorkerQueue] + 286
11  CVJM                                0x0000000102d76cc9 -[FIRAMeasurement setEnabledOnWorkerQueue:] + 117
12  CVJM                                0x0000000102d8caea __52-[FIRAScheduler scheduleOnWorkerQueueBlockID:block:]_block_invoke + 32
13  libdispatch.dylib                   0x000000010a3767ab _dispatch_call_block_and_release + 12
14  libdispatch.dylib                   0x000000010a3777ec _dispatch_client_callout + 8
15  libdispatch.dylib                   0x000000010a37fbe5 _dispatch_queue_serial_drain + 1305
16  libdispatch.dylib                   0x000000010a3804fa _dispatch_queue_invoke + 328
17  libdispatch.dylib                   0x000000010a38336c _dispatch_root_queue_drain + 664
18  libdispatch.dylib                   0x000000010a383076 _dispatch_worker_thread3 + 132
19  libsystem_pthread.dylib             0x000000010a8a2169 _pthread_wqthread + 1387
20  libsystem_pthread.dylib             0x000000010a8a1be9 start_wqthread + 13
2018-08-02 16:40:30.802 CVJM[6670] <Warning> [Firebase/Analytics][I-ACS032003] iAd framework is not linked. Search Ad Attribution Reporter is disabled.
2018-08-02 16:40:30.805 CVJM[6670] <Notice> [Firebase/Analytics][I-ACS023012] Firebase Analytics enabled
libc++abi.dylib: terminating with uncaught exception of type NSException

这是我里面的代码AppDelegate.m

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  NSURL *jsCodeLocation;

  // Debug
  //jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
  // Release
  jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];

  RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
                                                      moduleName:@"MODULE"
                                               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];

  // Firebase
  [FIRApp configure];
  [[UNUserNotificationCenter currentNotificationCenter] setDelegate:self];

  [[UIApplication sharedApplication] setApplicationIconBadgeNumber:0];

  return YES;
}
4

2 回答 2

1

我找到了解决方案。

这是我之前的 podfile:

# Pods for MyApp
  pod 'Firebase/Core', '4.0.0'
  pod 'Firebase/Messaging'

删除'4.0.0'并运行后pod update,它将 Firebase 更新为5.x.x. 不是它工作得很好。

于 2018-08-03T08:04:27.840 回答
0

打开Xcode并打开AppDelagate.m import this #import <Firebase.h> add in开头的didFinishLaunchingWithOptions [FIRApp configure];

例如

#import <Firebase.h>

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  [FIRApp configure];
//rest codes
}
于 2020-08-24T08:29:48.810 回答