I want to store the viewpoint from the viewpointChanged signal. This works well on PC & Android, but crashes on MacOS and iOS. Actually the crash is intermittent on iOS.
Starting from the QML template, add the following in the MapView:
onViewpointChanged: {
let point = GeometryEngine.project(mapView.screenToLocation(width / 2, height / 2), Factory.SpatialReference.createWgs84())
//point.x // Weird hack which fixes crash on MacOS/iOS
let viewpoint = ArcGISRuntimeEnvironment.createObject("ViewpointCenter", {center: point, targetScale: mapView.mapScale})
console.log(viewpoint.json)
}
Note that if I uncomment the "point.x", then the crash goes away.