start(with:completionHandler:)
Submits the request to create a snapshot and executes the resulting block on the specified queue.
Declaration
func start(with queue: dispatch_queue_t, completionHandler: @escaping @Sendable (MKMapSnapshotter.Snapshot?, (any Error)?) -> Void)func start(with queue: dispatch_queue_t) async throws -> MKMapSnapshotter.SnapshotParameters
- queue:
The dispatch queue on which to execute the block that the
completionHandlerparameter specifies. - completionHandler:
The block to call with the resulting snapshot. This block can’t be
nil.
Discussion
Call this method to begin generating a snapshot image based on the specified parameters. This method executes the request asynchronously. When rendering is complete, the snapshotter delivers the results to your block on the dispatch queue in the queue parameter.
The snapshotter delivers the final image to your app only when it’s running in the foreground. The snapshotter needs to render the final image while your app is in the foreground. If you start generating a snapshot while the app is in the background, or if your app moves to the background while a snapshot is in progress, this behavior delays the delivery of the snapshot until your app returns to the foreground.
In macOS, this method creates both standard and high-resolution representations of the map data and includes both in the returned image object. In iOS, you need to specify the image scale you want using the snapshot options, which defaults to the scale on the current device.