MKMapView not honoring safeAreaInsets or additionalSafeAreaInsets on iOS 11

Originator:kurt
Number:rdar://35116174 Date Originated:10/22/2017
Status:Dupe/Open Resolved:No
Product:iOS Product Version:11
Classification:UI/Usability Reproducible:Yes
 
Area:
MapKit

Summary:
When using an MKMapView with "safeAreaInsets" or "additionalSafeAreaInsets" in a UIViewController, the "Legal" link at the bottom left, the scale bar at the top left, and the compass at the top right are NOT honoring these metrics.

Steps to Reproduce:
Add an MKMapView as a child view of a UIViewController, and set the "additionalSafeAreaInsets" property to be non-zero on the top, left, bottom and right. I've attached a sample project you can use to reproduce this issue (it's a very basic MKMapView in a UIViewController).

Expected Results:
The MKMapView should inset the "Legal" link, scale bar, and compass appropriately for the insets provided.

Actual Results:
The "Legal" link, scale bar, and compass are ignoring the "safeAreaInsets" and "additionalSafeAreaInsets" properties entirely. It can be seen that the "safeAreaInsets" property is ignored on the iPhone X in the simulator, since the "Legal" link appears below the home indicator. I've attached a screenshot of the iPhone X simulator running iOS 11.0.1, and a screenshot of an iPhone 6 running iOS 11.0.3. I've also noticed this issue on an iPad Pro 9.7" running iOS 11.1 beta 4.

iPhone X simulator screenshot: https://i.imgur.com/hxHSsrT.png
iPhone 6 device screenshot: https://i.imgur.com/nXYt7xZ.jpg

Version/Build:
Occurs with Xcode 9.0.1 in any iOS 11 simulator, and occurs with Xcode 9.1 beta 2 in any iOS 11 simulator and on any 11.1 beta 4 device.

Configuration:
iPhone X simulator running iOS 11.0.1 and an iPhone 6 running iOS 11.0.3.

Comments

Mostly solved in iOS 11

While the insets aren't respected for me, too, there are better solutions for 3 of the 4 Buttons/Views:

MapKit defines MKCompassButton, MKScaleView, MKUserTrackingButton that can be placed freely inside and outside the mapView and are fully functional. See the WWDC 2017 MapKit video for details how to use them.

The only button Apple has forgotten is the legal button so the problem remains.

By gerd.castan at Aug. 18, 2018, 7:24 a.m. (reply...)

Accompanying error messages

I am having this problem too and have noticed various error messages about insetting the map controls, such as "Could not inset legal attribution from corner 4". I have no idea why this id happening though.

This has been marked as a duplicate of 34974586.


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!