set mapView.delegate with Google Maps iOS SDK 1.4

家住魔仙堡 提交于 2019-12-11 11:58:47

问题



I just updated from Google Maps iOS SDK 1.3.1 to 1.4 and now my app crashes when I set the delegate like mapView_.delegate = self. If I delete this line my delegate methods are not called.

How can I set the delegate in v 1.4?
Thanks


回答1:


Hope you have added the googlemaps framework and bundle correctly. Ensure your header file has

@interface yourViewController : UIViewController<GMSMapViewDelegate>

In your implementation file ensure that you set the delegate only after initialising your mapView_. That is below order should be followed:

mapView_ = [GMSMapView mapWithFrame:CGRectZero camera:camera];
mapView_.delegate = self;



回答2:


In 1.4 there are new delegate methods. Make sure you implement the required ones.

The two new methods in 1.4 are

  • mapView:willMove: and
  • mapView:idleAtCameraPosition:


来源:https://stackoverflow.com/questions/17877202/set-mapview-delegate-with-google-maps-ios-sdk-1-4

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!