Select to view content in your preferred language

Crashe sometimes when add operetionalLayer to AGSMap

1300
2
Jump to solution
03-06-2017 07:54 AM
TércyoStorck1
Occasional Contributor

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!)
     }
})
0 Kudos
1 Solution

Accepted Solutions
RyanOlson1
Esri Contributor

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.

View solution in original post

2 Replies
SuganyaBaskaran1
Esri Contributor

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. 

0 Kudos
RyanOlson1
Esri Contributor

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.