Hi,
Sometimes when i add a AGSFeaturelayer to my AGSMap, the application crashes. But the weird thing is it not occurs always, only sometimes.
Below my code:
let geodatabase = AGSGeodatabase(fileURL: geodatabaseURL!)
geodatabase.load(completion: {(error:Error?) in
if error == nil {
let reversedFeaturetables = geodatabase.geodatabaseFeatureTables.reversed()
for featureTable in reversedFeaturetables {
self.mapView.map?.operationalLayers.add(AGSFeatureLayer(featureTable: featureTable))
}
} else {
print(error!)
}
})
Solved! Go to Solution.
Make sure you hold a reference to the AGSGeodatabase object, even after you create the layers. If it gets dealloc'd then it will try to clean up itself and you could end up with some undefined behavior.
Thanks for reporting.
Does it crash with just the one geodatabase? Could you try running the sample service here and see if that works? That should help us narrow down the issue.
Can you also provide the stack trace from the crash? That could give us more details as to why it crashed. You can get it by typing "bt" in the console after the crash.
Make sure you hold a reference to the AGSGeodatabase object, even after you create the layers. If it gets dealloc'd then it will try to clean up itself and you could end up with some undefined behavior.