002_Firebase_iOS

集成过程中踩的坑

  1. 用Xcode的Swift Package Manager安装,因为Xcode不能使用代理,所以比较麻烦。所以改用CocoaPods。下边是用pod的注意事项。

  2. 以前是pod 'Firebase/Auth',现在是pod 'FirebaseAuth'

  3. 需要加上use_frameworks!这里说了Breaking change: Podfiles must include use_frameworks! or use_frameworks! :linkage => :static.

  4. 如果报错'GoogleUtilities/GULURLSessionDataResponse.h' file not found,可能是pod下来的版本不对。我的做法是注释掉pod 'FirebaseAuth'后再pod。参考这篇文章

  5. 如果报错Use of '@import' when C++ modules are disabled,需要在Other C++ Flags加上-fcxx-modules。参考这篇文章

制造崩溃

proj.ios_mac\ios\RootViewController.mm

- (void)loadView {
    //省略
    UIButton* button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    button.frame = CGRectMake(20, 50, 100, 30);
    [button setTitle:@"Test Crash" forState:UIControlStateNormal];
    [button addTarget:self action:@selector(crashButtonTapped:)
    forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:button];
}
- (IBAction)crashButtonTapped:(id)sender {
    @[][1];
}

查找并上传dYSM

Xcode->Organizer->Show in Finder->Show Package Contents

/path/to/pods/directory/FirebaseCrashlytics/upload-symbols -gsp /path/to/GoogleService-Info.plist -p ios /path/to/dSYMs