002_Firebase_iOS
集成过程中踩的坑
用Xcode的Swift Package Manager安装,因为Xcode不能使用代理,所以比较麻烦。所以改用CocoaPods。下边是用pod的注意事项。
以前是
pod 'Firebase/Auth'
,现在是pod 'FirebaseAuth'
需要加上
use_frameworks!
,这里说了Breaking change: Podfiles must include use_frameworks! or use_frameworks! :linkage => :static.
。如果报错
'GoogleUtilities/GULURLSessionDataResponse.h' file not found
,可能是pod下来的版本不对。我的做法是注释掉pod 'FirebaseAuth'
后再pod。参考这篇文章。如果报错
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