I was wondering if anyone else is actually trying to utilize mmpk files in their iOS apps. I've seen very little documentation on the feature, and I've not been able to successfully utilize it, yet.
I looked at the documentation here:
Display a map—ArcGIS Runtime SDK for iOS (Quartz Beta) | ArcGIS for Developers
and then generated the mmpk file as "mobile.mmpk" using ArcGIS Pro 1.2.0:
arcpy.management.CreateMobileMapPackage(...)
My ViewController (in Swift) looks like:
import UIKit
import ArcGIS
class ArcGisViewController: UIViewController {
@IBOutlet var mapView: AGSMapView!
override func viewDidLoad() {
super.viewDidLoad()
print("creating map")
createMap()
}
func createMap() {
if let filepath = NSBundle.mainBundle().pathForResource("mobile", ofType:"mmpk") {
print("found map")
let mobileMapPackage = AGSMobileMapPackage(path: filepath)
mobileMapPackage.loadWithCompletion { (error) -> Void in
if let error = error {
print(error.localizedDescription)
}
else {
// In this case the first map in the array is obtained
print ("setting map")
print("The mobile map package contains \(mobileMapPackage.maps.count) maps")
self.mapView.map = mobileMapPackage.maps[0]
}
}
}
}
}
However, when I run the program, I get a crash from what appears to be an invalid thread execution.
The log prints normally right up to the crash (showing that I have 1 map in the mmpk file).
The error is on the highlighted line.
I'm attaching screenshot of the debugger. Has anyone else successfully utilized a mmpk file? Is there a sample somewhere that gives a working example?
Thanks in advance,
-Glenn