在我的iOS应用中实施新的Google Maps SDK

时间:2012-12-14 12:40:16

标签: ios google-maps google-maps-sdk-ios

更新:我刚收到Google发送的有关新版Google地图iOS SDK的电子邮件。似乎一切都已经解决了。我已成功为我的应用创建新的API密钥!还没有测试它,但似乎是正确的。他们向我发送了this网址。

祝你好运!


我从昨天开始尝试更改我的代码,以便能够使用2天前发布的新版Google Maps SDK。我已按照所有说明进行操作,但直到现在还没有显示它们。 我已经请求了API密钥,但直到现在还没有任何回复。此外,我正在尝试从the Google APIs Console获取API密钥,但在服务列表中,我无法找到" Google Maps SDK for iOS"

其次,当我尝试运行我的应用程序(在模拟器上)时,屏幕是黑色的,我只能在左侧看到Google徽标(并按下它)。我在日志屏幕上收到这些消息:

2012-12-14 12:20:57.132 CoL[515:7a03] Google Maps SDK for iOS version: 1.0.1.1154
2012-12-14 12:20:57.132 CoL[515:7a03] New version of Google Maps SDK for iOS available: 1.0.1.1154
2012-12-14 12:20:57.192 CoL[515:c07] ClientParametersRequest failed, 3 attempts remaining. Error Domain=DASHConnectionError Code=100 "The operation couldn’t be completed. (DASHConnectionError error 100.)"
2012-12-14 12:20:57.242 CoL[515:c07] ClientParametersRequest failed, 2 attempts remaining. Error Domain=DASHConnectionError Code=100 "The operation couldn’t be completed. (DASHConnectionError error 100.)"
2012-12-14 12:21:01.291 CoL[515:c07] ClientParametersRequest failed, 1 attempts remaining. Error Domain=DASHConnectionError Code=100 "The operation couldn’t be completed. (DASHConnectionError error 100.)"
2012-12-14 12:21:09.314 CoL[515:c07] ClientParametersRequest failed, 0 attempts remaining. Error Domain=DASHConnectionError Code=100 "The operation couldn’t be completed. (DASHConnectionError error 100.)"
2012-12-14 12:21:13.339 CoL[515:c07] ClientParametersRequest failed, 3 attempts remaining. Error Domain=DASHConnectionError Code=100 "The operation couldn’t be completed. (DASHConnectionError error 100.)"
2012-12-14 12:21:13.363 CoL[515:c07] ClientParametersRequest failed, 2 attempts remaining. Error Domain=DASHConnectionError Code=100 "The operation couldn’t be completed. (DASHConnectionError error 100.)"
2012-12-14 12:21:17.386 CoL[515:c07] ClientParametersRequest failed, 1 attempts remaining. Error Domain=DASHConnectionError Code=100 "The operation couldn’t be completed. (DASHConnectionError error 100.)"

更新:注意到项目无法在设备(iPhone 4S,iOS 6)上成功构建。我不知道这与我上面的问题有关,但这里是错误:

ld: file is universal (2 slices) but does not contain a(n) armv7s slice: /Users/.../GoogleMaps.framework/GoogleMaps for architecture armv7s
clang: error: linker command failed with exit code 1 (use -v to see invocation)

以及我的架构部分的外观 enter image description here

任何能够让它发挥作用的人?

7 个答案:

答案 0 :(得分:8)

我有真正的答案。所以我也获得了访问SDK的权限,但它仍然不适合我。它显示为灰色地图,上面有一个别针。

修复步骤:

清理Xcode项目。 重置iOS模拟器。 关闭Xcode和模拟器。 启动并运行。

显然要确保你的api在那里,否则根本不会工作。

答案 1 :(得分:4)

您需要API密钥才能使用新的Google地图SDK。这就是their page中提到的内容。

  

感谢您关注Google Maps SDK for iOS。目前   我们正在为API密钥访问应用程序。请提供   以下有关您的应用的详情。 我们会在成功申请时邮寄   密钥可用。

所以你必须等到钥匙可用。

检查this google maps start page。您可以在那里注册您的项目,它将可用。

对于第二个问题,请检查此File is universal (three slices), but it does not contain a(n) ARMv7-s slice error for static libraries on iOS, anyway to bypass?。您可能必须从项目中删除对armv7的支持。

答案 2 :(得分:2)

就我而言,在我收到iOS的API密钥激活之前花了四天时间。

收到Google发来的电子邮件后,再次访问API服务页面,那时您应该可以在API服务列表中看到 Google Maps SDK for iOS ,那么您现在可以在项目中使用您给定的API API。

在您项目的AppDelegate方法application:didFinishLaunchingWithOptions:上添加此代码:

[GMSServices provideAPIKey:@"YOUR_API_KEY"];

答案 3 :(得分:1)

检查您的API Key是否有效。用于创建API Key的捆绑标识符应该是正确的。将API Key放入

[GMSServices provideAPIKey:@"YOUR_API_KEY"];

这会有所帮助。

答案 4 :(得分:1)

我遇到了类似的问题,我的问题是我用来在Google生成密钥的捆绑标识符与我在Xcode中使用的标识符不同。在纠正标识符时,我解决了问题。

答案 5 :(得分:0)

由于API密钥失败而发生此故障。 您必须首先使用here中的项目名称和包标识符创建项目。 然后根据需要启用Google Maps Directions API,适用于iOS的Google Maps SDK。 Screen shot 然后复制api密钥并使用:GoogleMaps without CocoaPods

答案 6 :(得分:0)

检查步骤 -

  1. 提供API密钥,如果您没有API密钥,请从Google API控制台日志中选择一个项目。

  2. 检查所需框架 -

    -CoreBluetooth.framework
    -OpenGLES.framework
    -ImageIO.framework
    -CoreData.framework
    -CoreText.framework
    -QuartzCore.framework
    -SystemConfiguration.framework
    -GLKit.framework
    -CoreLocation.framework
    -Security.framework
    -Accelerate.framework
    -libc++abi.tbd
    -libc++.1.tbd
    -libc.tbd
    -libicucore.tbd
    
  3. 3.检查链接器标志 - 添加" -ObjC" &安培; " $(继承)"如果没有添加

    4.Check Architecture - 添加" $(ARCHS_STANDARD)"例如(arm7,arm64)如果没有添加

    5.检查Copy Bundle Resources是否存在bundle。

    如果可以成功运行,请提供反馈。我想了解iPhone 4s中的地图性能,因为iPhone 4s具有较旧的OpenGL版本,因此帧率可能会变低并且有时会导致地图冻结。

    希望这有帮助,谢谢........ :)