When I try to initialize the map, app crashed. I have same issue in UIkit.
I try clean pods, update pod and clean project. Last week it was working correctly, no joke
iOS: 16.2
iPhone: 14 plus
GoogleMaps 7.4.0
Code
func makeUIView(context: Context) -> GMSMapView {
let camera: GMSCameraPosition = .init(latitude: currentLocation.latitude, longitude: currentLocation.longitude, zoom: 16.0)
crash here --> let mapView = GMSMapView.map(withFrame: CGRect.zero, camera: camera)
mapView.delegate = context.coordinator
mapView.isMyLocationEnabled = true
context.coordinator.mapView = mapView
self.updateCircle(mapView: mapView)
return mapView
}
Report file
Date/Time: 2024-02-27 20:42:46.7377 -0600
Launch Time: 2024-02-27 20:36:28.3196 -0600
OS Version: macOS 13.4.1
Release Type: User
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Triggered by Thread: 17
Thread 0:: Dispatch queue: com.apple.main-thread
0 ??? 0x1491f5f50 ???
1 ??? 0x1491f5da0 ???
2 app-name 0x105075b60 __InstrumentSessionWithConfigurationDelegateDelegateQueue_block_invoke + 48
3 app-name 0x11311ee34 -[GMSx_GTMSessionFetcher createSessionWithDelegate:sessionIdentifier:] + 569
4 app-name 0x11311dedb -[GMSx_GTMSessionFetcher beginFetchMayDelay:mayAuthorize:mayDecorate:] + 2019
5 app-name 0x1130de6b0 GMSAllSDKCheckForUpdatesImpl + 281
6 libdispatch.dylib 0x1611fef5b _dispatch_client_callout + 8
7 libdispatch.dylib 0x1612005b5 _dispatch_once_callout + 66
8 app-name 0x1130387eb -[GMSServices initWithDisplayLink:resourceCache:clearcutClient:dataURL:cachesURL:options:] + 3558
9 app-name 0x11301844f invocation function for block in CompleteInit(GMSAsyncInitServices*) + 241
10 app-name 0x1130181e3 CompleteInit(GMSAsyncInitServices*) + 345
11 app-name 0x11301825b -[GMSAsyncInitServices services] + 67
12 app-name 0x11303758d +[GMSServices sharedServicesSync] + 136
13 app-name 0x113023c89 -[GMSMapView initWithFrame:] + 40
14 app-name 0x104d79b6d @nonobjc GMSMapView.init(frame:) + 61
15 app-name 0x104d76f2a GMSMapView.__allocating_init(frame:) + 74
16 app-name 0x10b442d26 AddressMapKit.makeUIView(context:) + 278 (AddressMapKit.swift:27)
17 app-name 0x10b443299 protocol witness for UIViewRepresentable.makeUIView(context:) in conformance AddressMapKit + 73
2
Answers
I have a update. we saw that it was a problem with metal
If i turn off metal renderer, app is ok GMSServices.setMetalRendererEnabled(false)
let camera: GMSCameraPosition
has correct position, put static valid data for latitude and longitude and check, if it works nowAppDelegate
with your API key before this view tries to use it.mapView.isMyLocationEnabled = true
attempts to access the device’s location. Make sure you have requested and been granted location permissions in your Info.plist file (NSLocationWhenInUseUsageDescription
for foreground access).