The purpose of this repo is to show a bug in the MKMapSnapshotter: if the snapshotter function start(completionHandler: @escaping MKMapSnapshotter.CompletionHandler)
issues an error in its completionHandler
, then the snapshotter cannot be used anymore unless the device is rebooted.
What is happening is, after the first error, the completion handler is not called anymore.
This project contains only one view controller: ViewController
. This view controller contains a scroll view that displays a map snapshot. When zooming inside a snapshot, it gathers a better quality snapshot (i.e. same geographic area but snapshot image is bigger).
The first snapshot is taken at a low
quality (892x713
). After zooming, the snapshot is taken at a high
quality (4460x3565
).
In order to trigger an error every time when requesting a high
quality snapshot, the high
quality corresponds to a very big image.
There is a UILabel at the bottom of the screen to display the current quality and any error that happened.
- Launch the app
A snapshot should be displayed, debug label should tell that the low quality is currently displayed. - Zoom in the snapshot
As the big quality cannot be loaded, the snapshotter will issue an error, this will be displayed in the debug label. Please note that this is not the bug as the completion handler is correctly called back with the error. - Kill the app and relaunch it.
This is to display the low quality again
=> The low quality snapshot won't load. In fact, the completionHandler
is not called.
๐ In order to display the snapshot again, you must reboot the device. ๐ญ
Tested on:
Xcode 10.2, 10.3 ; iOS 12.3.1 (iPhone X)
Xcode 11 beta 4 ; iOS 13.0 (iPhone Xr)