• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

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

[复制链接]
菜鸟教程小白 发表于 2022-12-13 11:00:34 | 显示全部楼层 |阅读模式 打印 上一主题 下一主题

我有一个现有的项目,我正在尝试让 Google map 在其中运行。我遵循了 Google map 的文档,但它是这样进行的:

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

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.1'
pod 'GoogleMaps'

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

    [!] 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) 标志,它没有做任何事情。我删除了build设置,它给了我大约 90 个错误。我正在使用其他一些框架(Parse、Facebook SDK),所以我不认为更改这些标志是一种选择。

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

appDelegate.m 我添加了 #import (Google's tuorial 只是说 #import 但那是 Xcode 自动为我填写的内容,它说 GoogleMaps.h 没有找到)。然后在我的 application:didFinishLaunchingWithOptions: 中添加了 [GMSServices provideAPIKey"myAPIKey"];

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

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)

第二行和最后一行都是突出显示的。我已经尝试了从搜索这些错误中找到的内容 - 将框架拖到 Link Binary with Libraries(给了我大约 90 个错误),并检查我导入的是 .h 而不是 .m.

有什么想法吗?



Best Answer-推荐答案


我建议尝试两件事:

  1. 再次执行您对 $(inherited) 所做的操作。这是必须的。

  2. 在两个项目设置(您的应用和 pod)中,将 Build Active Architecture Only 更改为 No

关于ios - 如何让 Google-Maps API 正常工作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30904260/

回复

使用道具 举报

懒得打字嘛,点击右侧快捷回复 【右侧内容,后台自定义】
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关注0

粉丝2

帖子830918

发布主题
阅读排行 更多
广告位

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap