问题
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:
andmapView:idleAtCameraPosition:
来源:https://stackoverflow.com/questions/17877202/set-mapview-delegate-with-google-maps-ios-sdk-1-4