1

I try desperately to get the MKMapSnapshotter running on the simulator. However it works without issues on real devices, but not on the simulator which brings some trouble for me now with different iOS versions I do not have as hardware.

Is it by purpose to not work on the simulator? I did not found anything about this.

Here the code that works obviously only on real devices:

@IBAction func buttonPressed(_ sender: Any) {

    let loc = CLLocationCoordinate2D(latitude: 48.0, longitude: 11.3)
    let region = MKCoordinateRegionMakeWithDistance(loc, 100.0, 100.0)

    let options = MKMapSnapshotOptions()
    options.region = region
    options.scale = 2.0
    options.size = CGSize(width: 1024.0, height: 768.0)

    let snapshotter = MKMapSnapshotter(options: options)
    snapshotter.start(completionHandler: (
        {(snapshot, error) in
            print ("I am never called in simulator")

    })
    )

}

PS: tried in XCode 9.4.1

CptLeChuck70
  • 85
  • 10
  • Your code makes no sense. A map snapshotter does not need or use a map view, so what is the map view for? Just prepare the snapshotter and take the shot. – matt Aug 21 '18 at 20:16
  • Your `dateiInTempPfad` is also pointless. You define it and then you throw it away. – matt Aug 21 '18 at 20:16
  • @matt Thanks for your reply, but it did not add any value to the actual problem, I copied the code of a larger project, that's why it did include a mapView and a file path for the snapshot to be saved. I removed now all irrelevant lines from above and created a tiny function that is working on a real device but not in simulator. Is there any possibility to get the MKMapSnapshotter running on simulator? Or did I miss something? – CptLeChuck70 Aug 22 '18 at 17:38

0 Answers0