Why is Google Maps SDK not working on iPhone 6 iOS

2019-09-09 22:28发布

问题:

I tried searching this on SO as well as other sites but I can't find the cause of it.

So I'm running the stock Google Map SDK on my iPhone 6 on iOS 8.1 using Xcode 6.1:

- (void)viewDidLoad {
  [super viewDidLoad];
  GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:-33.868
                                                          longitude:151.2086
                                                               zoom:6];
  GMSMapView *mapView = [GMSMapView mapWithFrame:CGRectZero camera:camera];

  GMSMarker *marker = [[GMSMarker alloc] init];
  marker.position = camera.target;
  marker.snippet = @"Hello World";
  marker.appearAnimation = kGMSMarkerAnimationPop;
  marker.map = mapView;

  self.view = mapView;
}

I'm not sure exactly what the issue is in regards to the GMSMapView mapView object.

It's running just fine on my iPhone 5 and iPhone 4 on iOS 7.1

Is it an update compatibility issue to support the iPhone 6 hardware or something?

回答1:

I have found out that I was not following the Google Maps SDK documentation properly, resulting in this error.

After adding the GoogleMaps.framework and GoogleMaps.bundle to your project, you have to add the following frameworks in the EXACT order as listed in the documentation:

  • AVFoundation.framework
  • CoreData.framework
  • CoreLocation.framework
  • CoreText.framework
  • GLKit.framework
  • ImageIO.framework
  • libc++.dylib
  • libicucore.dylib
  • libz.dylib
  • OpenGLES.framework
  • QuartzCore.framework
  • SystemConfiguration.framework

The error went away after I deleted all the frameworks that wasn't in this order, and added as mentioned by the documentation.