I’m seeing the following crash occurring on the below view:
Thread 6 name:
Thread 6 Crashed:
0 libsystem_kernel.dylib 0x00000001d700c464 __terminate_with_payload + 8
1 libsystem_kernel.dylib 0x00000001d702acac abort_with_payload_wrapper_internal + 136 (terminate_with_reason.c:106)
2 libsystem_kernel.dylib 0x00000001d702ac24 abort_with_reason + 32 (terminate_with_reason.c:116)
3 VectorKit 0x00000001ab152a3c ggl::MetalResourceManager::newBuffer(ggl::Buffer const*) + 328 (MetalResourceManager.mm:940)
4 VectorKit 0x00000001ab14fc20 ggl::MetalResourceAccessor::endAccess(unsigned char*, ggl::BufferData const*, gm::Range<unsigned long>, ggl::BufferAccess, ggl::BufferSync) + 104 (MetalResourceAccessor.mm:124)
5 VectorKit 0x00000001ab14fb60 ggl::ResourceAccessor::_endAccess(unsigned char*, ggl::ResourceAccessor*, ggl::BufferData const*, gm::Range<unsigned long>, ggl::BufferAccess, ggl::BufferSync) + 136 (ResourceAccessor.cpp:89)
6 VectorKit 0x00000001ab2b21d8 md::DaVinciGroundTileData::_buildTileMeshes(std::__1::shared_ptr<geo::codec::VectorTile> const&, ggl::ResourceAccessor*, std::__1::shared_ptr<gss::StylesheetManager<gss::PropertyID>> const&, std::_... + 8508 (DaVinciGroundTileData.mm:0)
7 VectorKit 0x00000001ab412d54 std::__1::__function::__func<md::DaVinciGroundTileData::DaVinciGroundTileData(gdc::LayerDataRequestKey const&, std::__1::vector<gdc::Resource::LoadMetadata, std::__1::allocator<gdc::Resource::LoadM... + 1168 (function.h:364)
8 VectorKit 0x00000001ab273b20 ggl::MetalLoader::performWithAccessor(std::__1::function<void (ggl::ResourceAccessor*)> const&, std::__1::shared_ptr<ggl::RenderTransaction> const&) + 72 (MetalLoader.mm:30)
9 VectorKit 0x00000001ab243c10 md::DaVinciGroundTileData::DaVinciGroundTileData(gdc::LayerDataRequestKey const&, std::__1::vector<gdc::Resource::LoadMetadata, std::__1::allocator<gdc::Resource::LoadMetadata>>&&, std::__1::shared... + 1764 (DaVinciGroundTileData.mm:194)
10 VectorKit 0x00000001ab242ed4 md::DaVinciGroundLayerDataSource::createLayerData(gdc::LayerDataRequestKey const&, geo::linear_map<unsigned short, std::__1::unordered_map<gdc::ResourceKey, std::__1::shared_ptr<gdc::Resource>, gdc... + 252 (DaVinciGroundLayerDataSource.mm:62)
11 VectorKit 0x00000001ab281f48 gdc::LayerDataSource::updateLayerData(unsigned long, gdc::LayerDataRequestKey const&, geo::linear_map<unsigned short, std::__1::unordered_map<gdc::ResourceKey, std::__1::shared_ptr<gdc::Resource>, ... + 140 (LayerDataSource.cpp:693)
12 VectorKit 0x00000001ab281d9c std::__1::__function::__func<gdc::LayerDataSource::processLayerDataRequests(gdc::ResourceManager*, geo::TaskGroup*, long long)::$_5, std::__1::allocator<gdc::LayerDataSource::processLayerDataReques... + 164 (function.h:364)
13 VectorKit 0x00000001ab281ca0 invocation function for block in geo::TaskQueue::queueAsyncTask(std::__1::shared_ptr<geo::Task>, dispatch_group_s*) + 108 (TaskQueue.hpp:397)
14 libdispatch.dylib 0x0000000195dec13c _dispatch_call_block_and_release + 32 (init.c:1530)
15 libdispatch.dylib 0x0000000195deddd4 _dispatch_client_callout + 20 (object.m:576)
16 libdispatch.dylib 0x0000000195df12d8 _dispatch_continuation_pop + 600 (queue.c:321)
17 libdispatch.dylib 0x0000000195df0988 _dispatch_async_redirect_invoke + 732 (queue.c:845)
18 libdispatch.dylib 0x0000000195dff894 _dispatch_root_queue_drain + 392 (queue.c:7136)
19 libdispatch.dylib 0x0000000195e0009c _dispatch_worker_thread2 + 156 (queue.c:7204)
20 libsystem_pthread.dylib 0x00000001ead9f8f8 _pthread_wqthread + 228 (pthread.c:2709)
21 libsystem_pthread.dylib 0x00000001ead9c0cc start_wqthread + 8 (:-1)
View Code:
import SwiftUI
import MapKit
struct ListingMapView: View {
@Environment(.dismiss) var dismiss
@State private var cameraPosition: MapCameraPosition
@State private var selectedListingId: Int?
@State private var showListingPreview = false
@Binding var isChildView: Bool
@State private var navigateToDetail = false
init(isChildView: Binding<Bool>) {
let coordinateRegion = MKCoordinateRegion(
center: RestaurantService.shared.restaurants.first?.coordinates ?? CLLocationCoordinate2D(latitude: 34.0549, longitude: -118.2426),
latitudinalMeters: 50000,
longitudinalMeters: 50000
)
self._cameraPosition = State(wrappedValue: .region(coordinateRegion))
self._isChildView = isChildView
}
var body: some View {
NavigationView {
ZStack(alignment: .bottom) {
Map(position: $cameraPosition, selection: $selectedListingId) {
ForEach(RestaurantService.shared.restaurants, id: .self) { listing in
Marker("", coordinate: listing.coordinates)
.tag(listing.id)
}
}
.onChange(of: selectedListingId) { oldValue, newValue in
if newValue != nil {
showListingPreview = true
} else {
showListingPreview = false
}
}
.ignoresSafeArea()
VStack {
Spacer()
if showListingPreview, let listing = selectedListingId {
MapListingView(listingId: .constant(listing))
.onTapGesture {
navigateToDetail = true
}
.transition(.slide)
.animation(.default, value: selectedListingId)
}
}
}
.overlay(alignment: .topLeading) {
Button(action: { dismiss() }) {
Image(systemName: "chevron.left")
.foregroundColor(.black)
.background(
Circle()
.fill(.white)
.frame(width: 45, height: 45)
.shadow(radius: 4)
)
.padding(.top, 40)
.padding(.leading, 32)
}
}
.onAppear {
isChildView = true
}
.toolbar(.hidden, for: .tabBar)
.background(
NavigationLink(
destination: selectedListingId.map { listing in
ListingDetailView(
listingId: listing,
isChildView: .constant(true)
)
.environmentObject(RestaurantService.shared)
.navigationBarBackButtonHidden(true)
.onDisappear {
clearSelectedListing()
}
},
isActive: $navigateToDetail
) {
EmptyView()
}
.hidden()
.navigationBarBackButtonHidden(true)
)
}
.navigationBarBackButtonHidden(true)
}
func clearSelectedListing() {
selectedListingId = nil
showListingPreview = false
}
}
struct ListingMapView_Previews: PreviewProvider {
static var previews: some View {
ListingMapView(isChildView: .constant(true))
}
}
The feedback I received from the user is that they were clicking around the different pins on the map and zooming in & out when this happened. Could this be a resource issue? The crash log is a bit cryptic to understand.