使用Google Maps SDK for IOS时Apple Mach-O Linker出错 [英] Apple Mach-O Linker Error when using Google Maps SDK for IOS

查看:282
本文介绍了使用Google Maps SDK for IOS时Apple Mach-O Linker出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在我的应用中使用Google Maps SDK。到目前为止,我已经链接了所有框架。我很确定我已根据 -ObjC 标记rel =nofollow>说明。但是,当我将他们的代码复制并粘贴到我的 ViewController.m 类时,我收到以下错误:

I am trying to use the Google Maps SDK in my app. So far, I have linked all the frameworks. I am pretty sure I have added the appropriate -ObjC flags as per the instructions. However, when I copied and pasted their code into my ViewController.m class, I get the following errors:


架构i386的未定义符号:

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

Undefined symbols for architecture i386:
"_OBJC_CLASS_$_GMSCameraPosition", referenced from: objc-class-ref in FoothillTourViewController.o "_OBJC_CLASS_$_GMSMapView", referenced from: objc-class-ref in FoothillTourViewController.o "_OBJC_CLASS_$_GMSMarker", referenced from: objc-class-ref in FoothillTourViewController.o "_OBJC_CLASS_$_GMSServices", referenced from: objc-class-ref in FoothillTourAppDelegate.o ld: symbol(s) not found for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation)

FoothillTourViewController是我的 ViewController 的名称类。
这是我的View Controller类的代码。代码直接取自说明。

"FoothillTourViewController" is the name of my ViewController class. Here is the code for my View Controller class. The code is taken straight from the instructions.

#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_;
  }

任何帮助都会受到高度赞赏,因为我花了好几个小时试图搞清楚发生什么事。我猜它是一个愚蠢的错误,但我不能把它放在它上面。谢谢!

Any help would be greatly appreciated as I have been spending hours trying to figure out what is happening. I'm guessing its a stupid mistake, but I can't put my finger on it. Thanks!

推荐答案

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

UPDATE: this answer is outdated. The documentation now tells you to use CocoaPods instead of manually linking dependencies.

有关详细信息,请参阅 Google Developers Console

For more information, see Google Developers Console.

OLD ANSWER:

Google Maps SDK要求您链接相当多的框架。它们是:

The Google Maps SDK requires you to link quite a few frameworks. Here they are:


  • AVFoundation.framework

  • CoreData.framework

  • CoreLocation.framework

  • CoreText.framework

  • GLKit.framework

  • ImageIO.framework

  • libc ++。dylib

  • libicucore.dylib

  • libz.dylib

  • OpenGLES.framework

  • QuartzCore.framework

  • SystemConfiguration.framework

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

我在此处找到了此列表。

这篇关于使用Google Maps SDK for IOS时Apple Mach-O Linker出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆