首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何让Google-Maps API正常工作?

如何让Google-Maps API正常工作?
EN

Stack Overflow用户
提问于 2015-06-18 07:41:54
回答 1查看 478关注 0票数 2

我有一个现有的项目,我正在尝试让谷歌地图工作。我遵循了谷歌地图的文档,但它是这样进行的:

在我的项目目录中创建了Podfile。它包含:

代码语言:javascript
复制
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.1'
pod 'GoogleMaps'

然后我运行pod install。它给了我两个警告:

代码语言:javascript
复制
    [!] The `My App [Debug]` target overrides the `OTHER_LDFLAGS` build setting defined in `Pods/Target Support Files/Pods/Pods.debug.xcconfig'. This can lead to problems with the CocoaPods installation
        - Use the `$(inherited)` flag, or
        - Remove the build settings from the target.

    [!] The `My App [Release]` target overrides the `OTHER_LDFLAGS` build setting defined in `Pods/Target Support Files/Pods/Pods.release.xcconfig'. This can lead to problems with the CocoaPods installation
        - Use the `$(inherited)` flag, or
        - Remove the build settings from the target.

我尝试使用$(inherited)标志,它没有任何作用。我删除了构建设置,它给了我大约90个错误。我正在使用一些其他的框架(Parse,Facebook SDK),所以我不认为改变这些标志是一个选择。

然后,我使用myApp.xcworkspace打开项目。

appDelegate.m中,我添加了#import <GoogleMaps/GoogleMaps.h> (Google's tuorial只显示#import <GoogleMaps.h>,但这是Xcode自动为我填充的内容,并且它显示未找到GoogleMaps.h )。然后在我的application: didFinishLaunchingWithOptions:中添加了[GMSServices provideAPIKey:@"myAPIKey"];

当我尝试运行时,它会给我两个错误:

代码语言:javascript
复制
Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_GMSServices", referenced from:
      objc-class-ref in AppDelegate.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

第二行和最后一行都是突出显示的。我已经尝试了通过搜索这些错误所能找到的东西--将框架拖到带有库的链接二进制文件中(给了我大约90个错误),并检查我导入的是.h而不是.m

有什么想法吗?

EN

回答 1

Stack Overflow用户

发布于 2015-06-18 14:57:22

我建议尝试两件事:

  1. 再次执行您对$(inherited)所做的操作。这是必须的。在两个项目设置(您的应用程序和pod)中,将No.

更改为

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/30904260

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档