适用于 iOS 的 Google Maps SDK 要求 GoogleMaps.bundle 成为“复制捆绑资源”下的目标的一部分
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14744479/
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
Google Maps SDK for iOS requires GoogleMaps.bundle to be part of your target under 'Copy Bundle Resources
提问by JohnyDgoode
When I build a GoogleMaps SDK for iOS,these error occurred.
当我为 iOS 构建 GoogleMaps SDK 时,发生了这些错误。
*** Terminating app due to uncaught exception 'GMSException', reason: 'Google Maps SDK for iOS requires GoogleMaps.bundle to be part of your target under 'Copy Bundle Resources''
but,GoogleMaps.framework is in copy bundle resources.so,I'm confused.please tell me cause of this problem.
但是,GoogleMaps.framework 在复制包资源中。所以,我很困惑。请告诉我这个问题的原因。
回答by sberley
The instructions are kinda lacking. I hope this helps...
说明有点欠缺。我希望这有帮助...
- Launch Xcode (easy)
Drag the GoogleMaps.framework bundle to the Frameworks group of your project. When prompted, select Copy itemsinto destination group's folder.
Right-click GoogleMaps.framework in your project, and select Show In Finder. What it doesn't say is...Then go into the child folder called Resources
Drag the GoogleMaps.bundle from 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.
- 启动 Xcode(简单)
将 GoogleMaps.framework 包拖到项目的 Frameworks 组中。出现提示时,选择将项目复制到目标组的文件夹中。
右键单击项目中的 GoogleMaps.framework,然后选择在 Finder 中显示。 它没有说的是......然后进入名为Resources的子文件夹
将 GoogleMaps.bundle 从 Resources 文件夹拖到您的项目中。我们建议将它放在框架组中。出现提示时,确保未选择将项目复制到目标组的文件夹中。
回答by Glenn
To the 2017 people searching on SO, the easiest way is indeed try the installing and updating your pod by of course pod install
and pod update
. Then finally, clean the project and the build by these two commands:
对于 2017 年搜索 SO 的人来说,最简单的方法确实是尝试通过当然pod install
和pod update
. 最后,通过这两个命令清理项目和构建:
- Clean Build:
Command + alt option + Shift + K
- Clean Project:
Command + Shift + K
- 清洁构建:
Command + alt option + Shift + K
- 清洁项目:
Command + Shift + K
Then voila! Crash won't happen again.
然后瞧!崩溃不会再次发生。
回答by user8671173
For those of you trying this out in 2017 with Xcode 9 (first release) and the new build system, the following resolved this for me.
对于那些在 2017 年使用 Xcode 9(第一版)和新构建系统进行尝试的人,以下内容为我解决了这个问题。
Note: The fundamental issue seems to be that the new build system is NOT cleaning properly, so you need to switch back to the old system. Also as of 9/25/17 the google place picker is calling UI off the main thread and is throwing errors in Xcode.
注意:基本问题似乎是新构建系统没有正确清理,因此您需要切换回旧系统。同样截至 2017 年 9 月 25 日,谷歌地点选择器正在从主线程调用 UI,并在 Xcode 中引发错误。
-Switch to old build system
-切换到旧的构建系统
-click your project file "My App Name"
- 单击您的项目文件“我的应用程序名称”
-Under "TARGETS" click your app name (not tests or UITests!)
- 在“目标”下单击您的应用程序名称(不是测试或 UITests!)
-build phases
-构建阶段
-[CP] Copy Pods Resources
-[CP] 复制 Pods 资源
-You should see ${PODS_ROOT}/GoogleSomething , select those and hit -
- 你应该看到 ${PODS_ROOT}/GoogleSomething ,选择那些并点击 -
-Close Xcode, run pod install.
- 关闭 Xcode,运行 pod install。
-Open Xcode, Command-Shift-K (clean, and MAKE SURE YOU'RE ON THE OLD BUILD SYSTEM!)
- 打开 Xcode,Command-Shift-K(干净,并确保您使用的是旧构建系统!)
-Build/Run, should work now
- 构建/运行,现在应该可以工作了
回答by RedBlueThing
If you are experiencing this issue in a more recent version of this framework and are using the CocoaPods deployment, then check that the "Copy Pods Resources" section of "Build Phases":
如果您在此框架的更新版本中遇到此问题并且正在使用 CocoaPods 部署,请检查“构建阶段”的“复制 Pods 资源”部分:
Apparently this section going missing is a thing and deleting your Pods directory and re-running "pod install" isn't sufficient to fix it. Instead you will need to grab thishandy tool:
显然,这部分丢失是一回事,删除您的 Pods 目录并重新运行“ pod install”不足以修复它。相反,您需要使用这个方便的工具:
https://github.com/CocoaPods/cocoapods-deintegrate
https://github.com/CocoaPods/cocoapods-deintegrate
Run this thing and then re run pod installand your "Copy Pods Resources" section should be back and you won't get this exception when you instantiate your map.
运行这个东西,然后重新运行pod install,你的“复制 Pods 资源”部分应该回来了,当你实例化你的地图时,你不会得到这个异常。
回答by Abdul Hannan
running "pod install" fixed this issue for me.
运行“pod install”为我解决了这个问题。
回答by Sreeraj VR
回答by sahiljain
I was facing same issue, do the following:
我遇到了同样的问题,请执行以下操作:
1. Go to derived folder and delete the project folder
2. Clean build and run
Fixed the issue
修复了问题
回答by Murugan M
For Me i have the same issue in the manual installation.
对我来说,我在手动安装中遇到了同样的问题。
1.right-click GoogleMaps.framework in your project, and select Show In Finder .
1. 右键单击项目中的 GoogleMaps.framework,然后选择 Show In Finder 。
- double click or Open this GoogleMaps.framework. we can able to see the Folder "Resources" . (i have added the image Screen Shot for the where GoogleMaps.bundle available)
- click the Resources folder we can find the GoogleMaps.bundle
- 双击或打开此 GoogleMaps.framework。我们可以看到文件夹“Resources”。(我已经为 GoogleMaps.bundle 可用的地方添加了图像屏幕截图)
- 点击Resources文件夹我们可以找到GoogleMaps.bundle
- now just Drag and Drop the GoogleMaps.bundle into your project. ensure Copy items into destination group's folder is not selected.
Note: ensure "Copy items if Needed" destination group's folder is not selected. see the Screen shot too.
注意:确保未选择“需要时复制项目”目标组的文件夹。也请参阅屏幕截图。
now Clean the Command+Shift+K or Xcode-->Product--> Clean
现在清理 Command+Shift+K 或 Xcode-->Product--> Clean
this may helps to someone.
这可能对某人有所帮助。
回答by Lance Samaria
Once I updated to Xcode 9 Swift 3.2 I kept getting a crash inside AppDelegate at this line:
一旦我更新到 Xcode 9 Swift 3.2,我在 AppDelegate 中一直在这一行崩溃:
GMSServices.openSourceLicenseInfo()
I kept using Glenn's answer to clean the project which definitely worked but eventually the crash kept happening.
我一直使用格伦的回答来清理确实有效的项目,但最终崩溃仍在发生。
To solve it I had to follow the directions in Google Maps API Installation
为了解决这个问题,我必须按照谷歌地图 API 安装中的说明进行操作
Follow:
跟随:
Step 2: Install the SDKand Install Manually
第二步:安装SDK并手动安装
This is very easy to do but 1 thing sort of confused me at first so I'm adding it in for clarity for the next person:
这很容易做到,但一开始让我有点困惑,所以为了下一个人的清晰起见,我将其添加进来:
Once your read the manual instructions and on number 4 it says:
一旦您阅读了手册说明并在第 4 条上说:
4. Drag the following bundles into your project (when prompted, select Copy items if needed):
The thing is inside the zip file that you download, once you unpack it there are only going be 2 frameworks inside of it:
这个东西在你下载的 zip 文件中,一旦你解压它,里面只有 2 个框架:
GoogleMaps.framework
GoogleMapsCore.framework
There won't be a GoogleMapsBase.framework
. I'm assuming they bundled it into the GoogleMaps.framework
?
不会有GoogleMapsBase.framework
. 我假设他们将它捆绑到GoogleMaps.framework
?
Once you get to number 8: Open the Build Phases tab, and within Link Binary with Libraries, add the following frameworks:
. It lists a number of frameworks that you have to import.
一旦你到达 number 8: Open the Build Phases tab, and within Link Binary with Libraries, add the following frameworks:
。它列出了许多您必须导入的框架。
The problem is the first 3 that are listed that it says to add were already added (actually two of them were added -GoogleMaps.framework
and GoogleMapsCore.framework
) when you unpacked that zip file and dragged them into your project.
问题是当您解压缩该 zip 文件并将它们拖到您的项目中时,它说要添加的前 3 个已添加(实际上其中两个已添加 -GoogleMaps.framework
和GoogleMapsCore.framework
)。
I kept typing in the names and nothing would show up.
我一直在输入名字,什么也没有显示。
I kept deleting all the Google frameworks, starting from the beginning, and trying again until I realized they already existed. Basically type in the names of everything from Accelerate.framework
- UIKit.framework
and you should be good.
我不断地删除所有谷歌框架,从头开始,再试一次,直到我意识到它们已经存在。基本上输入所有内容的名称Accelerate.framework
-UIKit.framework
你应该很好。
回答by Tunvir Rahman Tusher
This way I have fixed my issue.
这样我就解决了我的问题。
1. Delete the derived folder.
2. pod update
3. Clean Project and build.
Thats all
就这样