简体   繁体   English

谷歌地图 SDK 错误

[英]Google Maps SDK Error

I installed GoogleMaps with cocoapods which installed fine, however when I run the app and try to run the snippet Google provides in their docs I get the error:我安装了带有 cocoapods 的GoogleMaps ,安装得很好,但是当我运行该应用程序并尝试运行 Google 在其文档中提供的代码段时,我收到错误消息:

W0815 21:50:35.497383       1 commandlineflags.cc:1503] Ignoring RegisterValidateFunction() for flag pointer 0x100bc8210: no flag found at that address

CoreData: annotation:  Failed to load optimized model at path '/var/containers/Bundle/Application/7689CC83-309E-4D44-B5E0-697601B96C61/BoostRadius-iOS.app/GoogleMaps.bundle/GMSCacheStorage.momd/StorageWithTileProto.omo'

CoreData: annotation:  Failed to load optimized model at path '/var/containers/Bundle/Application/7689CC83-309E-4D44-B5E0-697601B96C61/BoostRadius-iOS.app/GoogleMaps.bundle/GMSCacheStorage.momd/StorageWithTileProto.omo'

CoreData: annotation:  Failed to load optimized model at path '/var/containers/Bundle/Application/7689CC83-309E-4D44-B5E0-697601B96C61/BoostRadius-iOS.app/GoogleMaps.bundle/GMSCacheStorage.momd/StorageWithTileProto.omo'

The code is straight from the docs代码直接来自 文档

override func viewDidLoad() {
    super.viewDidLoad()
    view.backgroundColor = .green

    let camera = GMSCameraPosition.camera(withLatitude: -33.86, longitude: 151.20, zoom: 6.0)
    let mapView = GMSMapView.map(withFrame: CGRect.zero, camera: camera)
    view = mapView

    // Creates a marker in the center of the map.
    let marker = GMSMarker()
    marker.position = CLLocationCoordinate2D(latitude: -33.86, longitude: 151.20)
    marker.title = "Sydney"
    marker.snippet = "Australia"
    marker.map = mapView
}

I am using Xcode 10 beta 5, Swift 4.2我正在使用 Xcode 10 beta 5,Swift 4.2

It looks like this bug has already been filed in Google issue tracker:看起来这个错误已经在谷歌问题跟踪器中提交了:

https://issuetracker.google.com/issues/64504919 https://issuetracker.google.com/issues/64504919

Unfortunately, not resolved yet.不幸的是,还没有解决。 I would suggest to star this bug in issue tracker to express your interest and subscribe to further notifications from Google.我建议在问题跟踪器中标记此错误以表达您的兴趣并订阅来自 Google 的进一步通知。

Hopefully, Google will fix it soon.希望谷歌能尽快修复它。

Update更新

Google marked the aforementioned bug as fixed with the following comment:谷歌用以下评论将上述错误标记为已修复:

We believe this issue should now be solved with the new version of the SDK v3.3.我们相信这个问题现在应该可以通过新版本的 SDK v3.3 来解决。 Let us know otherwise.否则让我们知道。

Regarding the iPadOs issue mentioned in comment#78 could you please open a new issue with the same description to track it?关于评论#78 中提到的 iPadOs 问题,您能否打开一个具有相同描述的新问题来跟踪它?

I had this issue when first building my project with Xcode 10 with the GoogleMaps SDK version 2.7.0.我在第一次使用 Xcode 10 和 GoogleMaps SDK 2.7.0 版构建我的项目时遇到了这个问题。 I previously had no issues with Xcode 9.X.我以前对 Xcode 9.X 没有任何问题。 In my case, this was a relatively old project, for which the GoogleMaps SDK had been initially included by copying the bundle and framework directly into the project.就我而言,这是一个相对较旧的项目,最初通过将捆绑包和框架直接复制到项目中来包含 GoogleMaps SDK。 The copy step was not removed when the GoogleMaps SDK was subsequently added via CocoaPods.当 GoogleMaps SDK 随后通过 CocoaPods 添加时,复制步骤并未被移除。 The inclusion of the original GoogleMaps.bundle and GoogleMaps.frameworks files in the project caused the crash.项目中包含原始的 GoogleMaps.bundle 和 GoogleMaps.frameworks 文件导致了崩溃。 When I removed the copy step for the old GoogleMaps.bundle file, the issue resolved itself.当我删除旧 GoogleMaps.bundle 文件的复制步骤时,问题自行解决。 To remove the copy step:要删除复制步骤:

1) Select your workspace in the Xcode file explorer. 1) 在 Xcode 文件资源管理器中选择您的工作区。

2) Select your target in the workspace navigator. 2) 在工作区导航器中选择您的目标。

3) Select build phases. 3) 选择构建阶段。

4) In the section "Copy Bundle Resources", make sure that there is not an entry for GoogleMaps.bundle. 4) 在“复制捆绑资源”部分中,确保没有 GoogleMaps.bundle 的条目。 If there is, remove it.如果有,请将其删除。

5) Build and run. 5) 构建并运行。

If all works, you can safely remove the old GoogleMaps.bundle and GoogleMaps.framework files from your project.如果一切正常,您可以安全地从项目中删除旧的 GoogleMaps.bundle 和 GoogleMaps.framework 文件。 Be sure you are not removing the Pod version.确保您没有删除 Pod 版本。 Also you can remove references to GoogleMaps in your target's Linked Frameworks and Libraries section.您也可以在目标的链接框架和库部分中删除对 GoogleMaps 的引用。

Make sure you had assigned the GMSMapView class to the view object.确保您已将GMSMapView类分配给视图对象。 Select your view object from Storyboard and add the custom class in the identity inspector.从 Storyboard 中选择您的视图对象并在身份检查器中添加自定义类。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM