gpt4 book ai didi

ios - 使用适用于 IOS 的 Google Maps SDK 时出现 Apple Mach-O 链接器错误

转载 作者:塔克拉玛干 更新时间:2023-11-02 09:08:11 25 4
gpt4 key购买 nike

我正在尝试在我的应用程序中使用 Google Maps SDK。到目前为止,我已经链接了所有的框架。我很确定我已经根据 instructions 添加了适当的 -ObjC 标志.但是,当我将他们的代码复制并粘贴到我的 ViewController.m 类中时,出现以下错误:

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 类的代码。代码直接取自说明。

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

任何帮助将不胜感激,因为我已经花了几个小时试图弄清楚发生了什么。我猜这是一个愚蠢的错误,但我不能指责它。谢谢!

最佳答案

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

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

旧答案:

Google Maps SDK 需要您链接相当多的框架。他们在这里:

  • AVFoundation.framework
  • 核心数据框架
  • CoreLocation.framework
  • CoreText.framework
  • GLKit.framework
  • ImageIO.framework
  • libc++.dylib
  • libicucore.dylib
  • libz.dylib
  • OpenGLES.framework
  • QuartzCore.framework
  • 系统配置.framework

我在 here 找到了这个列表.

关于ios - 使用适用于 IOS 的 Google Maps SDK 时出现 Apple Mach-O 链接器错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18027229/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com