<GoogleMaps/GoogleMaps.h> 文件未找到适用于 iOS 的 Google 地图 SDK

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15021006/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-30 22:23:31  来源:igfitidea点击:

<GoogleMaps/GoogleMaps.h> file not found Google Maps SDK for iOS

iosgoogle-mapsios5google-maps-sdk-ios

提问by ?ernando Valle

Yesterday I recived an email from google saying that I could acces to the map api for ios, I generated my key from the app console and I follow the steps of https://developers.google.com/maps/documentation/ios/startbut xcode throw this error.

昨天我收到一封来自谷歌的电子邮件,说我可以访问 ios 的地图 API,我从应用程序控制台生成了我的密钥,然后按照https://developers.google.com/maps/documentation/ios/start的步骤操作但是 xcode 抛出这个错误。

#import <GoogleMaps/GoogleMaps.h> //file not found

Thanks for your support.

谢谢您的支持。

It is normal that appears the Headers executable instead of the folder?

出现 Headers 可执行文件而不是文件夹是正常的吗?

enter image description here

在此处输入图片说明

SOLVED!

解决了!

回答by ?ernando Valle

Finally I have found the solution for my problem:

最后我找到了我的问题的解决方案:

1Extract the subfolder A in version and I renamed it to GoogleMaps.framework

1在版本中提取子文件夹 A 并将其重命名为 GoogleMaps.framework

2Copy this folder to your project folder.

2将此文件夹复制到您的项目文件夹。

enter image description here

在此处输入图片说明

3Add it to your Frameworks group in the project

3将其添加到项目中的 Frameworks 组中

enter image description here

在此处输入图片说明

4Import to AppDelegate as #import "GoogleMaps/GoogleMaps.h"

4导入到 AppDelegate 作为#import "GoogleMaps/GoogleMaps.h"

I will edit with images for people that have the same trouble.

我将为有同样问题的人编辑图像。

Thanks for all the people that helped me.

感谢所有帮助过我的人。

回答by Saxon Druce

Make sure you unzip the SDK with something which understands symbolic links.

确保使用能够理解符号链接的内容解压缩 SDK。

GoogleMaps.framework/Headersis a symbolic link to GoogleMaps.framework/Versions/A/Headers.

GoogleMaps.framework/Headers是到 的符号链接GoogleMaps.framework/Versions/A/Headers

When I unzip it on my Mac the symbolic link is set up correctly. But when I unzip it on my PC instead of symbolic links I get text files which just contain the path (eg Versions/Current/Headers).

当我在 Mac 上解压缩它时,符号链接设置正确。但是当我在我的 PC 上解压缩它而不是符号链接时,我得到只包含路径的文本文件(例如Versions/Current/Headers)。

If you unzip on a PC and then copy the folder to your Mac (or unzip using some other method which doesn't create symbolic links), then you will get the error you see.

如果您在 PC 上解压缩,然后将文件夹复制到 Mac(或使用其他不创建符号链接的方法解压缩),那么您将看到您看到的错误。

回答by PGLongo

Try this:

尝试这个:

Drag the GoogleMaps.frameworkbundle to the Frameworks group of your project. When prompted, select Copy items into destination group's folder.

GoogleMaps.framework拖到项目的 Frameworks 组中。出现提示时,选择将项目复制到目标组的文件夹中。

You have to copy the unzipped folder "GoogleMaps.framework" into XCode.

您必须将解压缩的文件夹“ GoogleMaps.framework”复制到XCode 中

Then follow steps 3 & 4

然后按照步骤 3 和 4

3.Right-click GoogleMaps.frameworkin your project, and select Show In Finder.

4.Drag the GoogleMaps.bundlefrom the Resources folder to your project. We suggest putting it in the Frameworks group. When prompted, ensure Copy items into destination group's folder is not selected.

3. 右键单击您项目中的GoogleMaps.framework,然后选择 Show In Finder。

4.将GoogleMaps.bundle从 Resources 文件夹拖到您的项目中。我们建议将它放在框架组中。出现提示时,确保未选择将项目复制到目标组的文件夹中。

If still not working try adding manually GoogleMaps.framework in the Build Phases tab->Link Binarywith Libraries

如果仍然不起作用,请尝试在 Build Phases 选项卡中手动添加 GoogleMaps.framework -> Link Binarywith Libraries

回答by nevan king

Here's the first few steps you need:

这是您需要的前几个步骤:

  • Download GoogleMaps-iOS-1.1.0.zipfrom their site
  • Unzip the file. You now have a GoogleMaps-iOS-1.1.0folder
  • In that folder you have a GoogleMaps.frameworkfolder.
  • Copy or move the GoogleMaps.frameworkfolder to inside your project folder (in Finder).
  • Drag the GoogleMaps.frameworkfolder onto your Frameworksgroup in Xcode.
  • In the options sheet, uncheck "Copy items into destination group's folder". Make sure your target is checked in "Add to targets". Click OK.
  • (Note that you can also do this the other way, by not copying it into your project folder and checking "Copy items into destination group's folder". Xcode will copy the folder itself.)

  • Import using #import "GoogleMaps/GoogleMaps.h". The angle bracket usually work too, but in this case it should use quotes.

  • GoogleMaps-iOS-1.1.0.zip从他们的网站下载
  • 解压缩文件。你现在有一个GoogleMaps-iOS-1.1.0文件夹
  • 在该文件夹中,您有一个GoogleMaps.framework文件夹。
  • GoogleMaps.framework文件夹复制或移动到项目文件夹内(在 Finder 中)。
  • GoogleMaps.framework文件夹拖到FrameworksXcode 中的组中。
  • 在选项表中,取消选中“将项目复制到目标组的文件夹”。确保您的目标在“添加到目标”中被选中。单击确定。
  • (请注意,您也可以通过其他方式执行此操作,即不要将其复制到您的项目文件夹中并选中“将项目复制到目标组的文件夹中”。Xcode 将复制文件夹本身。)

  • 使用#import "GoogleMaps/GoogleMaps.h". 尖括号通常也可以使用,但在这种情况下它应该使用引号。

You should end up with a golden toolbox icon:

你应该最终得到一个金色的工具箱图标:

enter image description here

在此处输入图片说明

Using an #importwith angle brackets should search the system frameworks, then inside your project folder, but to be safe try it with quotes.

使用#import带尖括号的应该搜索系统框架,然后在您的项目文件夹中,但为了安全起见,请尝试使用引号。

回答by Areal-17

the GoogleMaps framework is probably not in the Library folder but in the same directory like all other project files. I this case you have to write #import "GoogleMaps/GoogleMaps.hor #import "GoogleMaps.h"

GoogleMaps 框架可能不在 Library 文件夹中,而是在与所有其他项目文件相同的目录中。我这种情况你必须写#import "GoogleMaps/GoogleMaps.h#import "GoogleMaps.h"

回答by Soheil Jadidian

I've been struggling with this issue for hours; I'm using CocoaPods, Swift and Xcode 6.1.1. I followed all the steps for including GoogleMaps in my project carefully, tried many different things like removing symbolic links in the downloaded package or manually linking the binaries in build phases or trying #include "GoogleMaps.h", #include "GoogleMaps/GoogleMaps.h"and "#include <GoogleMaps/GoogleMaps.h>in my bridge file, none of that worked... Finally used CocoaPods instead of including the framework myself and it worked! Hope it helps someone out there:

我已经为这个问题苦苦挣扎了几个小时;我正在使用 CocoaPods、Swift 和 Xcode 6.1.1。我跟所有的步骤仔细,包括在我的项目的GoogleMaps,试图在下载的软件包中除去符号链接或手动连接的二进制文件构建阶段或尝试许多不同的东西#include "GoogleMaps.h"#include "GoogleMaps/GoogleMaps.h""#include <GoogleMaps/GoogleMaps.h>在我的桥文件,没有奏效......最后使用 CocoaPods 而不是我自己包含框架并且它起作用了!希望它可以帮助那里的人:

In the Podfile:

在 Podfile 中:

pod 'Google-Maps-iOS-SDK', '~> 1.9.2'

pod 'Google-Maps-iOS-SDK', '~> 1.9.2'

And in your Bridge file:

在您的 Bridge 文件中:

#import "GoogleMaps.h"

#import "GoogleMaps.h"

回答by brian.clear

make sure you upgrade to the latest sdk. v1 and v3 were different. had trouble getting v1 to work

确保升级到最新的sdk。v1 和 v3 是不同的。无法让 v1 正常工作

回答by ManhNguyen

Maybe you've forgot after change Podfile, you have to run

可能你在更改 Podfile 后忘记了,你必须运行

pod update

豆荚更新

then rerun react-native run-ios

然后重新运行 react-native run-ios

回答by Sadanand

Its better install Pod for google map, Just add google maps into pod. Note if you don't have pod file in your project folder ios/ then do below steps pod init

它更好地为谷歌地图安装 Pod,只需将谷歌地图添加到 Pod 中即可。请注意,如果您的项目文件夹 ios/ 中没有 pod 文件,请执行以下步骤 pod init

the add below code in your pod file

在您的 pod 文件中添加以下代码

platform :ios, '9.0'

target 'YourAppTarget' do
  pod 'GoogleMaps'  # <~~ remove this line if you do not want to support GoogleMaps on iOS
end
# pre_install do |installer|
   # copied from https://github.com/CocoaPods/CocoaPods/issues/2926
   # workaround for https://github.com/CocoaPods/CocoaPods/issues/3289
  #  def installer.verify_no_static_framework_transitive_dependencies; end
# end

target 'YourAppTarget-tvOS' do

end

Do not forget to add AirGoogleMaps to your project directory from node_modules/react-native-maps/lib/ios

不要忘记从 node_modules/react-native-maps/lib/ios 将 AirGoogleMaps 添加到您的项目目录

回答by iSekhar

This answer will also might help you. The above all answers are not worked for me at last after a long time i found like this

这个答案也可能对你有所帮助。很长一段时间后,我发现上述所有答案最终对我不起作用

# import "GoogleMapsM4B/GoogleMaps.h"

Use like this it definitely solves your problem

像这样使用它绝对可以解决您的问题