Search code examples
iosswiftmkmapviewmapkitmkmapsnapshotter

MKMapSnapshotter renders borders white


I am using MKMapSnapshotter to create a screenshot of a map which I then display in an UIImageView.

let imageView = UIImageView()
imageView.frame = view.bounds
view.addSubview(imageView)

let options = MKMapSnapshotOptions()
options.scale = UIScreen.mainScreen().scale
options.region = mapView.region
options.size = mapView.frame.size

let snapshotter = MKMapSnapshotter(options: options)
snapshotter.startWithCompletionHandler { (snapshot, error) -> Void in
    imageView.image = snapshot?.image
}

However, the resulting image seems to have ugly white lines instead of the standard thin red country (and federal) borders.

Simulator screenshot of image view

Is there any way I can make the screenshot look like the original map?

Simulator screenshot of map view


Solution

  • This seems to be a Simulator issue. I see the same issue on Simulator, but on real iOS 8 and iOS 9 devices snapshots contains proper country borders.