使用Google Maps SDK for IOS时Apple Mach-O Linker出错

Arj*_*wan 2 iphone xcode objective-c ios

我正在尝试在我的应用中使用Google Maps SDK.到目前为止,我已经链接了所有框架.我很确定我-ObjC按照说明添加了适当的标志.但是,当我将代码复制并粘贴到我的ViewController.m类中时,我收到以下错误:

架构i386的未定义符号:
"_ OBJC_CLASS _ $ _ GMSCameraPosition",引用自:FoothillTourViewController.o中的objc-class-ref"_OBJC_CLASS _ $ _ GMSMapView",引自:FoothillTourViewController.o中的objc-class-ref"_OBJC_CLASS _ $ _ GMSMarker",引用自:FoothillTourViewController.o中的objc-class-ref"_OBJC_CLASS _ $ _ GMSServices",引自:FoothillTourAppDelegate.o中的objc-class-ref:ld:未找到架构i386 clang的符号:错误:链接器命令失败,退出代码为1 (使用-v查看调用)

"FoothillTourViewController"是我ViewController班级的名字.这是我的View Controller类的代码.代码直接取自说明.

#import "FoothillTourViewController.h"
#import <GoogleMaps/GoogleMaps.h>

@implementation FoothillTourViewController {
    GMSMapView *mapView_;
}

// You don't need to modify the default initWithNibName:bundle: method.

  - (void)loadView {
  //Create a GMSCameraPosition that tells the map to display the
  // coordinate -33.86,151.20 at zoom level 6.
  GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:-33.86
                                                        longitude:151.20
                                                             zoom:6];
 mapView_ = [GMSMapView mapWithFrame:CGRectZero camera:camera];
 mapView_.myLocationEnabled = YES;
 self.view = mapView_;

  // Creates a marker in the center of the map.
  GMSMarker *marker = [[GMSMarker alloc] init];
  marker.position = CLLocationCoordinate2DMake(-33.86, 151.20);
  marker.title = @"Sydney";
  marker.snippet = @"Australia";
  marker.map = mapView_;
  }
Run Code Online (Sandbox Code Playgroud)

任何帮助都会非常感激,因为我花了好几个小时试图弄清楚发生了什么.我猜它是一个愚蠢的错误,但我不能把它放在它上面.谢谢!

who*_*ows 6

更新:这个答案已经过时了.文档现在告诉您使用CocoaPods而不是手动链接依赖项.

有关更多信息,请参阅Google Developers Console.

老答案:

Google Maps SDK要求您链接相当多的框架.他们来了:

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

我在这里找到了这个清单.