I’m developing a sandboxed macOS app with a Quick Look extension that previews user-selected files.
The preview includes an interactive MapKit map showing the route from the file
During TestFlight review, Apple rejected temporary entitlement exceptions for:
com.apple.security.temporary-exception.files.home-relative-path.read-only /Library/Caches/GeoServices/
com.apple.security.temporary-exception.mach-lookup.global-name com.apple.geoanalyticsd
I understand these temporary exceptions are not appropriate for Mac App Store distribution and will remove them.
What is the supported sandbox-compliant way to use MapKit inside a macOS Quick Look extension?
Should an interactive MapKit view work inside a sandboxed Quick Look extension without temporary exceptions, or is MapKit unsupported in this extension context?
If interactive MapKit is not supported, is MKMapSnapshotter the recommended alternative, or should the extension render a route-only preview without Apple map tiles?
Any guidance on the expected entitlement/capability setup for this scenario would be appreciated.
Hi @n0rt0nthec4t,
You wrote:
[...] This is the rendering I get with either MKMapSnapshotter OR MKMapView [...]
The behavior is two-fold—QuickLook extensions are sandboxed and prevent network access to protect the user's information. However, MapKit is a system framework and this use case should be reconsidered.
I'd suggest for you to create a report via Feedback Assistant. Once submitted, please reply here with the Feedback ID so I can escalate with the Quick Look team directly.
I want to be clear, this is not a bug or oversight, but a deliberate security boundary, there is no guarantee this will be fixed in a later release. MapKit's tile fetching is network activity. Even though the intent is to download map imagery (not upload user data), the sandbox doesn't distinguish between inbound and outbound purposes at the Mach service level.
Note: Even if other developers report this issue, it is essential that you each submit your own bug report. The number of bug reports for this issue will improve the likelihood of the underlying issue to be resolved quickly.
As a workaround, you could generate a static map image in your main app (which has full MapKit access) and cache it alongside or embedded in the file metadata:
// In your main app (full sandbox profile, MapKit works)
let snapshotter = MKMapSnapshotter(options: options)
snapshotter.start { snapshot, error in
guard let snapshot = snapshot else { return }
let image = snapshot.image
// Draw your route overlay onto the snapshot
// Cache the composed image (e.g., in extended attributes,
// a sidecar file, or embedded in your document format)
}
Then, in your Quick Look extension, simply load and display the cached image:
// In your QLPreviewingController
func providePreview(for request: QLFilePreviewRequest) async throws -> QLPreviewReply {
let reply = QLPreviewReply(contextSize: size, isBitmap: true) { context,
reply in
// Load pre-rendered map image from the file/sidecar
let mapImage = self.loadCachedMapImage(for: request.fileURL)
mapImage?.draw(in: rect)
return true
}
return reply
}
Alternatively, if you only need to show the route shape (not full cartography), draw the polyline yourself in Core Graphics:
func providePreview(for request: QLFilePreviewRequest) async throws -> QLPreviewReply {
return QLPreviewReply(contextSize: size, isBitmap: false) { context, reply in
let path = CGMutablePath()
// Convert route coordinates to view points via a simple
// Mercator projection fitted to the bounding box
for (i, point) in projectedPoints.enumerated() {
if i == 0 { path.move(to: point) }
else { path.addLine(to: point) }
}
context.setStrokeColor(NSColor.systemBlue.cgColor)
context.setLineWidth(3.0)
context.addPath(path)
context.strokePath()
return true
}
}
Lastly, consider using a mix of the pre-rendered base map as a fallback (option 1), overlaying live route geometry (option 2) from the file data. This keeps the preview responsive to file changes for the route while using a periodically-refreshed background.
Cheers,
Paris X Pinkney | WWDR | DTS Engineer