ios “GoogleMobileAds/GoogleMobileAds.h”文件未找到错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/28777884/
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
"GoogleMobileAds/GoogleMobileAds.h" file not found error
提问by Keoros
Recently I tried to update admob SDK(iOS) to the latest version(7.0.0)
最近我尝试将 admob SDK(iOS) 更新到最新版本 (7.0.0)
I have trouble importing the framework.
我在导入框架时遇到问题。
It keeps giving me this error "GoogleMobileAds/GoogleMobileAds.h" file not found
它不断给我这个错误 "GoogleMobileAds/GoogleMobileAds.h" file not found
I removed the old admob sdk and imported the framework manually.
我删除了旧的 admob sdk 并手动导入了框架。
I've tried
我试过了
- restart xcode
- cleaning the project (command + shift + k)
- remove the framework and add it again
- 重启xcode
- 清理项目(command + shift + k)
- 删除框架并再次添加
No luck, any ideas to solve this? thanks.
没有运气,有什么想法可以解决这个问题吗?谢谢。
回答by AndyW
Answer is to change the 'Framework Search Paths' build setting to the folder where your 'GoogleMobileAds.framework' is located.
答案是将“框架搜索路径”构建设置更改为“GoogleMobileAds.framework”所在的文件夹。
Full steps I did to solve:
我解决的完整步骤:
Remove references to the framework from project navigator
Click on your project in the project navigator, then on your project under 'TARGETS', then click 'Build Phases'
Expand 'Link Binary With Libraries'
Select 'GoogleMobileAds.framework' and click the '-' (if it's there)
Click the '+'
Click 'Add Other...', find and select 'GoogleMobileAds.framework' and click 'Open'
The google ads framework should now be in the list
Click 'Build Settings'
Change 'Framework Search Paths' to the folder where your 'GoogleMobileAds.framework' is located
Clean and re-build project
从项目导航器中删除对框架的引用
在项目导航器中单击您的项目,然后单击“目标”下的项目,然后单击“构建阶段”
展开“链接二进制与库”
选择“GoogleMobileAds.framework”并点击“-”(如果有)
点击“+”
点击“添加其他...”,找到并选择“GoogleMobileAds.framework”,然后点击“打开”
谷歌广告框架现在应该在列表中
单击“构建设置”
将“框架搜索路径”更改为“GoogleMobileAds.framework”所在的文件夹
清理并重新构建项目
回答by Guru
回答by MAC113
Right click on framework --> show in finder --> Delete framework from that place.--> go to the project and see at your framework place , its in red color .
右键单击框架--> 在查找器中显示--> 从该位置删除框架。--> 转到项目并查看您的框架位置,它是红色的。
Again right click on that and delete it. Again run project and save project . i know the build not successful.
再次右键单击并删除它。再次运行 project 并保存 project 。我知道构建不成功。
Again add the framework and then run before that clean your project.
再次添加框架,然后在清理项目之前运行。
回答by Ankit Kargathra
don't drag framework in your project.. just only copy past in your project folder and add files TO in your project..
不要在您的项目中拖动框架.. 只需在您的项目文件夹中复制过去并将文件添加到您的项目中..
i think it's 100% working.
我认为它100% 有效。
回答by Daniil Bystrov
回答by Adrian Min
I have tried to put the GoogleMobileAds.framework\Versions\A\Headers
folder to GoogleMobileAds.framework
folder and it worked for me.
我试图将GoogleMobileAds.framework\Versions\A\Headers
文件GoogleMobileAds.framework
夹放入文件夹,它对我有用。
Note:
You must delete Header
file first. It's already here in GoogleMobileAds.framework
folder.
And useGoogleMobileAds.framework\Versions\A\GoogleMobileAds
replace GoogleMobileAds.framework\GoogleMobileAds
注意:
您必须先删除Header
文件。它已经在GoogleMobileAds.framework
文件夹中了。
并使用GoogleMobileAds.framework\Versions\A\GoogleMobileAds
替换GoogleMobileAds.framework\GoogleMobileAds
回答by WannaBeHacker
I am manually dragging the AdMob SDK into my project and was getting this error. Ultimately what worked was I dragged the SDK files into my projects folder on the computer (for me it was: Users/aaronfrom/documents/projectname) when asked to replace files I said yes. It then worked. I think that this is where my framework search path was directed towares and I needed to update the files in the project folder on my computer, it had nothing to do with settings in Xcode.
我手动将 AdMob SDK 拖到我的项目中,但出现此错误。最终,当被要求替换文件时,我将 SDK 文件拖到计算机上的项目文件夹中(对我来说是:Users/aaronfrom/documents/projectname),我说是。然后它起作用了。我认为这是我的框架搜索路径指向软件的地方,我需要更新计算机上项目文件夹中的文件,这与 Xcode 中的设置无关。
回答by Imran Rasheed
This is the Solution
这是解决方案
#1 Open Terminal install Cocoapods -> $ sudo gem install cocoapods
#2 Open Terminal and Enter Path of Your Directory -> cd desktop/gamebuild
#3 Enter this on Terminal -> Pod Init
#4 Go To Directory Paste This Line in Podfile -> pod 'Google-Mobile-Ads-SDK'
#5 Close File and Enter this on Terminal-> Pod install