可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
When I build a GoogleMaps SDK for iOS,these error occurred.
*** 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.
回答1:
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 items into
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.
回答2:
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:
- Clean Build:
Command + alt option + Shift + K
- Clean Project:
Command + Shift + K
Then voila! Crash won't happen again.
回答3:
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.
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.
-Switch to old build system
-click your project file "My App Name"
-Under "TARGETS" click your app name (not tests or UITests!)
-build phases
-[CP] Copy Pods Resources
-You should see ${PODS_ROOT}/GoogleSomething , select those and hit -
-Close Xcode, run pod install.
-Open Xcode, Command-Shift-K (clean, and MAKE SURE YOU'RE ON THE OLD BUILD SYSTEM!)
-Build/Run, should work now
回答4:
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":
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 this handy tool:
https://github.com/CocoaPods/cocoapods-deintegrate
Run this thing and then re run pod install and your "Copy Pods Resources" section should be back and you won't get this exception when you instantiate your map.
回答5:
running "pod install" fixed this issue for me.
回答6:
If you installed the map via CocoaPods Try the following steps.
- Go to TARGETS > Build Phases
- Disable 'Run script only when installing'
回答7:
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
回答8:
Once I updated to Xcode 9 Swift 3.2 I kept getting a crash inside AppDelegate at this line:
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
Follow:
Step 2: Install the SDK and Install Manually
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. 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:
GoogleMaps.framework
GoogleMapsCore.framework
There won't be a GoogleMapsBase.framework
. I'm assuming they bundled it into the 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.
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.
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.
回答9:
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'
- find
GoogleMaps.bundle
in GoogleMap.frameword/Resources
you will see GoogleMap.bundle
- Drag
GoogleMaps.bundle
into Base/Framework
with GoogleMapsBase.framework
hope this can help. Thanks
回答10:
For Me i have the same issue in the manual installation.
1.right-click GoogleMaps.framework in your project, and select 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
- now just track 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
this may helps to someone.