I'm trying to load a mobile map package using the new Swift SDK version 200 (beta). It appears to add the layers and tables but no map shows in map view.
I'm getting the following once, the first time I call addTable to my apps map:
error occurred: code: 24
error message: Object is already owned.
error additional message: Already owned.
I get the following error each time I call addOperationalLayer():
error occurred: code: 4
error message: Out of range.
error additional message: position is out of range.
Solved! Go to Solution.
Welcome to the new SDK Duane! Please take a look at the attached demo project and see if it helps. A few key points to be aware of:
- The `loadLocalMapPackage` method should be only called once when the view is created, so the objects aren't recreated when the view body is recalculated.
- Make sure the loadable resources are loaded before you use them.
- The operational layers owned by one map cannot directly used as a reference by another map. This is the same as the old 100.x Runtime SDK. To use the layers in another map, there are a few options to consider
- Create copies of the layers. See the demo project.
- Create new layers from the backing tables.
- Host the data on ArcGIS Portal as service feature tables.
- Use mobile geodatabases instead of mobile map packages.
P.S. In case you aren't aware of, we also have a growing Swift Samples project on GitHub. You can find common patterns and examples of the new API in it. 🙂
Welcome to the new SDK Duane! Please take a look at the attached demo project and see if it helps. A few key points to be aware of:
- The `loadLocalMapPackage` method should be only called once when the view is created, so the objects aren't recreated when the view body is recalculated.
- Make sure the loadable resources are loaded before you use them.
- The operational layers owned by one map cannot directly used as a reference by another map. This is the same as the old 100.x Runtime SDK. To use the layers in another map, there are a few options to consider
- Create copies of the layers. See the demo project.
- Create new layers from the backing tables.
- Host the data on ArcGIS Portal as service feature tables.
- Use mobile geodatabases instead of mobile map packages.
P.S. In case you aren't aware of, we also have a growing Swift Samples project on GitHub. You can find common patterns and examples of the new API in it. 🙂
Thank you! I am able to see my map now. Still struggling with the tables however. Not sure how to create a copy; there is no clone() method.
If it is possible, you can send me a desensitized copy of your mmpk and I can take a look. There are many types of `FeatureTable`s and while some of them are plain tabular data, some others are more complex, so there might be different ways of using tables from one map to another.
Thankyou. I might not need to copy those after all.