下面是导致崩溃的代码
- (void)addMapView {
UIApplicationState appState = [[UIApplication sharedApplication] applicationState];
if((appState != UIApplicationStateBackground) && (appState != UIApplicationStateInactive)) {
if (!mapView) {
mapView = [[MKMapView alloc] initWithFrame:CGRectZero];
[mapView setZoomEnabled:NO];
mapView.scrollEnabled = NO;
// [mapView setCenterCoordinate:_coordinate2D zoomLevel:5 animated:NO];
annotationView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"profileLocationPoint"]];
[self addSubview:annotationView];
}
if (noneView.superview) {
[noneView removeFromSuperview];
noneView = nil;
}
if (!mapView.superview) {
[self insertSubview:mapView atIndex:0];
}
annotationView.hidden = NO;
}
}
以下是我在Firebase中收到的崩溃消息:
崩溃:com.apple.main-thread
0 VectorKit 0x1cf1904b8 ggl :: MTLShaderLibraryData :: MTLShaderLibraryData(ggl :: MetalLibrarySource,std :: __ 1 :: unique_ptr
1 VectorKit 0x1cf190480 ggl :: MTLShaderLibraryData :: MTLShaderLibraryData(ggl :: MetalLibrarySource,std :: __ 1 :: unique_ptr
2 VectorKit 0x1cf190844 ggl :: MTLBundleShaderLibraryData :: MTLBundleShaderLibraryData(char const *,unsigned int const *,char const **,unsigned long)+ 56
3 VectorKit 0x1cede60d0 ggl :: StandardLibraryBundleMTLData :: StandardLibraryBundleMTLData(char const *)+ 64
4 VectorKit 0x1cec58ca4 md :: Device :: Device(ggl :: DeviceAPI,ggl :: DeviceParameters)+ 420
5 VectorKit 0x1cec58ad8 md :: Device :: newDevice()+ 32
6 VectorKit 0x1cec285dc-[VKSharedResourcesManager资源] + 44
7 VectorKit 0x1cef1ef2c md :: MapEngine :: MapEngine(float,float,float,bool,std :: __ 1 :: shared_ptr
8 VectorKit 0x1cef1e8ec md :: MapEngine :: interactiveMapEngine(float,bool,md :: MapEngineConfigPair &&,unsigned long long,GEOApplicationAuditToken *)+ 144
9 VectorKit 0x1cec8387c-[VKMapView initShouldRasterize:inBackground:contentScale:auditToken:] + 928
10 MapKit 0x1ce3bebd8-[MKBasicMapView initWithFrame:andGlobe:shouldRasterize:] + 376
11 MapKit 0x1ce3e2bd4-[MKMapView _commonInitFromIB:gestureRecognizerHostView:showsAttribution:showsAppleLogo:] + 1264
12 MapKit 0x1ce3bf5b8-[MKMapView initWithFrame:] + 264
13 HelloTalk_Binary 0x104f60dcc-[HTUserinfoMapView addMapView] + 83(HTUserinfoMapView.m:83)
14 HelloTalk_Binary 0x104f60ae8-[HTUserinfoMapView initWithLatitude:longitude:] + 48(HTUserinfoMapView.m:48)
15 HelloTalk_Binary 0x102b2e7c4 HisProfileHeaderView.mapView.getter + 4306118596(:4306118596)
16 HelloTalk_Binary 0x102b2c85c HisProfileHeaderView.setupView()+ 32(HisProfileHeaderView.swift:32)
17 HelloTalk_Binary 0x102b2c754 HisProfileHeaderView.init()+ 21(HisProfileHeaderView.swift:21)
18 HelloTalk_Binary 0x102b2c7ac @objc HisProfileHeaderView.init()+ 4306110380(:4306110380)
19 HelloTalk_Binary 0x102d9f5a0 HisProfileViewController.userInfoHeaderView.getter + 246(HisProfileViewController.swift:246)
20 HelloTalk_Binary 0x102d9ed04 HisProfileViewController.bindViewModel()+ 200(HisProfileViewController.swift:200)
21 HelloTalk_Binary 0x102d9cd10 @objc HisProfileViewController.viewDidLoad()+ 81(HisProfileViewController.swift:81)
22 UIKitCore 0x1c446d65c-[UIViewController _sendViewDidLoadWithAppearanceProxyObjectTaggingEnabled] + 100
23 UIKitCore 0x1c44720ec-[UIViewController loadViewIfRequired] + 936
24 UIKitCore 0x1c44724f4-[UIViewController视图] + 28
25 UIKitCore 0x1c43d1d68-[UINavigationController _startCustomTransition:] + 1180
26 UIKitCore 0x1c43e5c30-[UINavigationController _startDeferredTransitionIfNeeded:] + 688
27 UIKitCore 0x1c43e6fd0-[UINavigationController __viewWillLayoutSubviews] + 172
28 UIKitCore 0x1c43ca530-[UILayoutContainerView layoutSubviews] + 224
29 UIKitCore 0x1c4f697fc-[UIView(CALayerDelegate)layoutSublayersO