Google ios sdk mapview with storyboard

Can you advise if storyboards are supported with google ios sdk v 1.1 maps. I get some weird results

I need to display controllers for cards. The first displays a single map and displays exactly when it is pressed on the navigation controller using the push segue storyboard.

I have another map view manager that loads multiple markers. This view controller is also on the storyboard, but loaded using a custom transition for a gradual transition.

I load the views according to the sdk examples in the loadView method.

I have 3 problems with him

1. The first time a map with multiple markers is loaded, the map is not displayed / displayed. When I click the button to display the view again (which does nothing if the view is loaded), it displays the map and markers.

2.I close this view and load another view using the custom segment. if I go back to viewing a map with multiple markers, I get an exception in the loadview method when it tries to assign mapview to a view

*** Terminating app due to uncaught exception 'UIViewControllerHierarchyInconsistency', reason: 'A view can only be associated with at most one view controller at a time! View <GMSVectorMapViewBridge: 0x150376a0; frame = (0 0; 320 416); layer = <CALayer: 0x15055cd0>> is associated with <GMMapResultsViewController: 0x10faa2a0>. Clear this association before associating this view with <GMMapResultsViewController: 0xb51ad90>. 

3.Lastly, if I load the first map view controller with one marker, it loads fine, and then return to the second map view controller with several markers. The same problem occurs when rendering a map. then if I try to select a map marker, it is not processed by the delegate. Even if it works fine, if I load this card for the first time.

+2
source share
2 answers

I suspect that if you follow the following, your problem may disappear ...

  • add a UIView to the view controller where you work.
  • set this type as GMSMapView in the identity inspector.

Then drag it into your code, as with any other outlet.

Once you do this, working with Google Maps will become quite simple.

+2
source

In case someone needs a working example: Google Maps 1.1.2 SDK with storyboard. You can find it on github: https://github.com/rendulic/GMaps3D

0
source

All Articles