MKMapkit constraint error when reopen project
Asked Answered
R

2

8

I built a custom view controller. It has 1 tableview, 2 views and 1 map. When I set the constraints for this layout it works fine. I close project and reopen the map view out of the view controller. The width and height are 1000 points. If I set the map on top of this stack, there is no problem. But when I set map in the middle of the other views, a problem happens. I must put this mapview inside another view or it affects the others, but the problem is still there.

I use Xcode 8 beta 5, and constraint is 0 0 0 0

enter image description here

Rhizocarpous answered 15/8, 2016 at 12:22 Comment(6)
What is "constraint is 0 0 0 0"?Aprilette
constraint top, right, bottom and leftRhizocarpous
sorry if I ask, but why using a beta version of Xcode? maybe the issue is related to this... does it happens on last Xcode 7?Felonry
I am build prototype app for ios 10 course, so I cant use Xcode 7 :DRhizocarpous
i think you enabled size classes but designing in a fixed size of IB. try to change it once.Chun
Try to add centerX, centerY and equals superview Height, equals superview Width to your mapView (you may need to embed it in another UIView).Samara
J
1

I have the same issue in the latest beta. I believe the problem is in the wrong default size, that is always set to 1000x1000 by Xcode for MKMapView.

I would wait for the fix in the next Xcode version.

If you, by some reason, really need it fixed now, you can setup a UIView with constraints as required, then put MKMapView inside the UIView and use Autoresizing to scale it.

enter image description here

Judy answered 25/8, 2016 at 3:59 Comment(0)
P
0

In re this very old question, the same or similar problem appears to exist in 2024.

Basically if you animate the size of a map (particularly try making it small), you will endlessly get ...

Will attempt to recover by breaking constraint <NSLayoutConstraint:0x600006391130 'UISV-canvas-connection' MKPassThroughStackView:0x102538e60.top == MKUserTrackingButton:0x1737c8560.top (active)>

and similar constraint complaints.

It does seem to be harmless - so sloppy by Apple.

Piggin answered 4/9 at 19:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.