kloder-games / godot-admob

Module Admob for Godot engine
MIT License
360 stars 61 forks source link

iOS Compilation is not working, Error: (modules/admob/ios/src/AdmobBanner.h:1:9:(1:9-1:42): fatal error. 'GoogleMobileAdsGADBannerView.h' file not found [1]) #87

Closed gumaciel closed 5 years ago

gumaciel commented 5 years ago

OS target (Android/iOS): iOS

Godot version: 3.0.6

Issue description:

Hello, I'm trying to compile the AdMob for iOS module (http://docs.godotengine.org/en/stable/development/compiling/compiling_for_ios.html). I did everything that was requested but is giving this error: image

Ps: the version of Google Mobile Ads SDK that I downloaded is the latest (7.44.0), I could not find the version 7.41.0

Shin-NiL commented 5 years ago

Did you did this step?

Copy the GoogleMobileAds.framework inside the exported Xcode project folder and link it using the "Link Binary with Libraries" option;

Ps: the version of Google Mobile Ads SDK that I downloaded is the latest (7.44.0), I could not find the version 7.41.0

Well, I'm afraid you'll get other issues as this module will not work with newer versions of Google Mobile Ads SDK. I don't have a Mac and I'm unable to update it. We need help from the community, but it seems like there's no much people developing to iOS on the Godot community.

gumaciel commented 5 years ago

pt-BR: Olá, desculpe pela demora,

Copy the GoogleMobileAds.framework inside the exported Xcode project folder and link it using the "Link Binary with Libraries" option;

Eu consigo exportar, o problema é que eu preciso de 2 arquivos que vão surgir após eu efetuar a compilação para iOS

Copy the library (.a) you have compiled following the official documentation inside the exported Xcode project. You must override the 'your_project_name.a' file with this file.

Eu não consigo baixar a versão (7.41.0), não existe nenhum lugar da internet que dê pra baixar essa versão, eu acho que a Kloder deveria colocar uma área para baixar essa versão, mas talvez isso vá contra os termos de serviço da Google, se alguém tiver essa versão e puder disponibilizar, eu ficarei bastante agradecido.

en-US: Hello, sorry for the delay,

Copy the GoogleMobileAds.framework inside the exported Xcode project folder and link it using the "Link Binary with Libraries" option;

I can export, the problem is that I need 2 files that will come up after I compile for iOS

Copy the library (.a) you have compiled following the official documentation inside the exported Xcode project. You must override the 'your_project_name.a' file with this file.

I can not download the version (7.41.0), there is no place on the internet to download this version, I think Kloder should put an area to download this version, but maybe this goes against Google's terms of service , if anyone has this version and can make it available, I will be very grateful.

gumaciel commented 5 years ago

Hello, I downloaded the version 7.41.0 of the Google Mobile SDK through CocoaPods, so the error continues, does anyone have a solution?

Shin-NiL commented 5 years ago

Did you do this?

Copy the GoogleMobileAds.framework inside the exported Xcode project folder and link it using the "Link Binary with Libraries" option;

GhostWalker562 commented 5 years ago

I found a solution, here's my best attempt at making steps.

  1. Download the GoogleMobileAds.framework, I used the latest one so I believe any version is fine.

  2. Go open a random project on Xcode and scroll to the bottom where there are frameworks and the section that says 'Link Binary With Libraries'

  3. Click on one of the existing framework and press 'Show in Finder'

  4. Add the downloaded framework into the Framework folder presented when doing the step above.

  5. You should now compile the godot source code with the AdMob module and the framework in the lib, ultimately making it easier to export using the template you just compiled.

I think the problem with the instructions, well at least for me, was that linking it is okay for exporting but for compiling there is no way of linking it until you actually put it in the frameworks folder. Idk this was just how I solved my problem and hopefully it helps somebody who doesn't get the instructions too.

gumaciel commented 5 years ago

Hi @GhostWalker562 and @Shin-NiL I tried what you asked to do and managed to compile by running all the commands from here (http://docs.godotengine.org/en/stable/development/compiling/compiling_for_ios.html), but couldn't run the last one command

"scons p=iphone tools=no target=release arch=x86_64"

gave the same error when I ran this command I mentioned above, but this file is for simulators only, so no problem.

But fortunately I was able to successfully compile this file (godot.iphone.opt.universal.a), done that, I replaced the project ".a" file with this generated file and asked to run it on my iPhone X, but when the game ran, the game closed and no longer opens, and the following erode appeared in Xcode:

Ps: I linked all libraries, but the last library, I just found a file "sqlite3" (it wasn't with extension ".framework"

(sorry for the delay in giving you feedback, I've been trying to fix it, but I've had no other success so far)

GhostWalker562 commented 5 years ago

@gustavottc If you're using the latest AdMob you may have to add your ID and link the flags. https://developers.google.com/admob/ios/quick-start On this page it will tell you all the other frameworks you need to put in your frameworks folder and aditionally configure your xCode manually, including adding the -ObjC and your GADApplicationIdentifier

gumaciel commented 5 years ago

@GhostWalker562 , it works, but it only opens the ad once, if I open the interticial ad, it can't open anymore unless I restart the app, but on Android it's working normal

any idea what it might be? I also tested with the sample project, but the same thing happens

GhostWalker562 commented 5 years ago

@gustavottc I’m not sure, perhaps it’s because of the ad not being displayed when loaded again, or not loading it all a second time? An ad must be prepared and loses before it is displayed every time. If this is not the problem then I am not sure. That was my problem but I fixed it and it works fine for me.

gumaciel commented 5 years ago

@GhostWalker562 could you please give me an example of code?

GhostWalker562 commented 5 years ago

`func _on_interstitial_loaded(): yield(get_tree().create_timer(2),"timeout") admob.showInterstitial()

func loadInterstitial(): if admob != null: admob.loadInterstitial(adUnitID)`

I called loadInterstitial() when I need to load an ad, and when it's done loading I would show it. @gustavottc

Shin-NiL commented 5 years ago

This issue should be fixed now. Can somebody test the last commit?

gumaciel commented 5 years ago

Hi, @GhostWalker562 and @Shin-NiL , these functions works.

But, when i try to show an Interstitial AD and after that a Banner AD, it gives me this error "Multiple locks on web thread not allowed" i already tried to use hideBanner() or resize(), but doesn't work.

GhostWalker562 commented 5 years ago

@gustavottc this is a known issue and is updated into the README. Idk if they fixed the issue, but it could be found in issue #53

gumaciel commented 5 years ago

Alright, I'll close this issue since the initial issue has already been resolved and the issue I'm dealing with now is another

Thank you so muh @GhostWalker562 and @Shin-NiL !

CompassDevs commented 4 years ago

@gustavottc Hello there Gustavo, there's any way i can get some help from you about this issue, i'm facing pretty much the same trouble, but i'm not able to re-solve it.

Let me know.

gumaciel commented 4 years ago

@CompassDevs hello, tomorrow i will write a detailed tutorial how solve it, I'm busy now, but don't worry it's easy to solve

gumaciel commented 4 years ago

@gustavottc Hello there Gustavo, there's any way i can get some help from you about this issue, i'm facing pretty much the same trouble, but i'm not able to re-solve it.

Let me know.

@CompassDevs , sorry for delay, this is my answer:

  1. Download the most recent stable version of Godot: https://downloads.tuxfamily.org/godotengine/3.1.2/godot-3.1.2-stable.tar.xz ;

  2. Download the module: https://github.com/kloder-games/godot-admob/archive/master.zip ;

  3. Drop the "admob" directory inside the "modules" directory on the Godot source;

  4. Download and extract the Google Mobile Ads SDK (https://developers.google.com/admob/ios/download) inside the directory "admob/ios/lib";

  5. Export your game to iOS without AdMob

  6. Go open the project on Xcode and scroll to the bottom where there are frameworks and the section that says 'Link Binary With Libraries'

  7. Click on one of the existing framework and press 'Show in Finder'

  8. Add the downloaded framework into the Framework folder presented when doing the step above.

  9. You may have to add your ID and link the flags. https://developers.google.com/admob/ios/quick-start On this page it will tell you all the other frameworks you need to put in your frameworks folder and aditionally configure your xCode manually, including adding the -ObjC and your GADApplicationIdentifier.

  10. You should now compile (http://docs.godotengine.org/en/stable/development/compiling/compiling_for_ios.html) the godot source code with the AdMob module and the framework in the lib, ultimately making it easier to export using the template you just compiled.

  11. Put the files that the compile create on the export project to iOS

I think it's it, if doesn't work, talk to me again.

CompassDevs commented 4 years ago

@gustavottc Hello there Gustavo, there's any way i can get some help from you about this issue, i'm facing pretty much the same trouble, but i'm not able to re-solve it. Let me know.

@CompassDevs , sorry for delay, this is my answer:

1. Download the most recent stable version of Godot: https://downloads.tuxfamily.org/godotengine/3.1.2/godot-3.1.2-stable.tar.xz ;

2. Download the module: https://github.com/kloder-games/godot-admob/archive/master.zip ;

3. Drop the "admob" directory inside the "modules" directory on the Godot source;

4. Download and extract the Google Mobile Ads SDK (https://developers.google.com/admob/ios/download) inside the directory "admob/ios/lib";

5. Export your game to iOS without AdMob

6. Go open the project on Xcode and scroll to the bottom where there are frameworks and the section that says 'Link Binary With Libraries'

7. Click on one of the existing framework and press 'Show in Finder'

8. Add the downloaded framework into the Framework folder presented when doing the step above.

9. You may have to add your ID and link the flags. https://developers.google.com/admob/ios/quick-start On this page it will tell you all the other frameworks you need to put in your frameworks folder and aditionally configure your xCode manually, including adding the -ObjC and your GADApplicationIdentifier.

10. You should now compile (http://docs.godotengine.org/en/stable/development/compiling/compiling_for_ios.html) the godot source code with the AdMob module and the framework in the lib, ultimately making it easier to export using the template you just compiled.

11. Put the files that the compile create on the export project to iOS

I think it's it, if doesn't work, talk to me again.

@gustavottc Thanks man, i'll give it a try this weekend. Before i do that i just confirm few doubts:

All the steps to be done in a Mac operating system i assume, then

Step 3: Shall i create a folder "modules" in the game folder of Godot and copy the admob Step 4: then this will be inside the "modules/admob..." created in step 3 Step 5: Normal game export Step 10: Compiling with scons as per link under Mac, i guess i have to get scons since is not pre-installed and follow the instructions

Thanks

PS: Se nao me engano voce e' brasileiro, se quiser podemos conversar em portugues. Obrigado irmao

gumaciel commented 4 years ago

@gustavottc Thanks man, i'll give it a try this weekend. Before i do that i just confirm few doubts:

All the steps to be done in a Mac operating system i assume, then

Step 3: Shall i create a folder "modules" in the game folder of Godot and copy the admob Step 4: then this will be inside the "modules/admob..." created in step 3 Step 5: Normal game export Step 10: Compiling with scons as per link under Mac, i guess i have to get scons since is not pre-installed and follow the instructions

Thanks

PS: Se nao me engano voce e' brasileiro, se quiser podemos conversar em portugues. Obrigado irmao

Sim, eu sou Brasileiro, mas eu prefiro falar em inglês mesmo, pois vai ajudar a outras pessoas que estiverem com o mesmo problema

Step 3: The folder "modules" is already created, and it's not on your game folder project, it's on root of Godot Game Engine Source folder that you downloaded on step 1 Step 4: You will put the admob modules inside the folder "modules" Step 5: Yes Step 10: Yes, you need to install Scons and Xcode 10.0 (or later) with the iOS (10.0) SDK and the command line tools.

CompassDevs commented 4 years ago

@gustavottc Thanks man, i'll give it a try this weekend. Before i do that i just confirm few doubts: All the steps to be done in a Mac operating system i assume, then Step 3: Shall i create a folder "modules" in the game folder of Godot and copy the admob Step 4: then this will be inside the "modules/admob..." created in step 3 Step 5: Normal game export Step 10: Compiling with scons as per link under Mac, i guess i have to get scons since is not pre-installed and follow the instructions Thanks PS: Se nao me engano voce e' brasileiro, se quiser podemos conversar em portugues. Obrigado irmao

Sim, eu sou Brasileiro, mas eu prefiro falar em inglês mesmo, pois vai ajudar a outras pessoas que estiverem com o mesmo problema

Step 3: The folder "modules" is already created, and it's not on your game folder project, it's on root of Godot Game Engine Source folder that you downloaded on step 1 Step 4: You will put the admob modules inside the folder "modules" Step 5: Yes Step 10: Yes, you need to install Scons and Xcode 10.0 (or later) with the iOS (10.0) SDK and the command line tools.

@gustavottc Thanks bro.

As per your answer on Step 3, i can't really find this folder, at least using Godot 3.1.1, is something that is created from the 3.1.2 version only? I'll give it a try. I guess this is the source of my issue then. I always thought this folder was in a different place.

Thanks again, really appreciate your help

gumaciel commented 4 years ago

@gustavottc Thanks bro.

As per your answer on Step 3, i can't really find this folder, at least using Godot 3.1.1, is something that is created from the 3.1.2 version only? I'll give it a try. I guess this is the source of my issue then. I always thought this folder was in a different place.

Thanks again, really appreciate your help

So are you using 3.1.1? Then download the source here: https://downloads.tuxfamily.org/godotengine/3.1.1/godot-3.1.1-stable.tar.xz

Then you will find this folder: image

Put the "admob" inside it, and it's it.

You're welcome.

martinpelli commented 4 years ago

@gustavottc hi, sorry to bother you, but I am doing all that you say And keep getting the same error and can’t find any tutorial. When you say that put the framework on the folder of the project, is the GoogleMobileAdsSdk folder the framework or only googlemobileads.framework that is inside of the GoogleMobileAdsSdk? And how I can link it? I go to build phases and then to link binary with libraries, click the add button and search for something like googlemobileads or something similar and I cant find anything.

gumaciel commented 4 years ago

hey @martinpelli try to do this:

  1. Go open the project on Xcode and scroll to the bottom where there are frameworks and the section that says 'Link Binary With Libraries'

  2. Click on one of the existing framework and press 'Show in Finder'

  3. Add the downloaded framework into the Framework folder presented when doing the step above.

martinpelli commented 4 years ago

hey @martinpelli try to do this:

  1. Go open the project on Xcode and scroll to the bottom where there are frameworks and the section that says 'Link Binary With Libraries'
  2. Click on one of the existing framework and press 'Show in Finder'
  3. Add the downloaded framework into the Framework folder presented when doing the step above.

Yes that what I did. When I click show in finder it took me to the folder where I have my xcode project, and I puting there the folder downloded from this zip https://developers.google.com/admob/ios/download

martinpelli commented 4 years ago

hey @martinpelli try to do this:

  1. Go open the project on Xcode and scroll to the bottom where there are frameworks and the section that says 'Link Binary With Libraries'
  2. Click on one of the existing framework and press 'Show in Finder'
  3. Add the downloaded framework into the Framework folder presented when doing the step above.

Yes that what I did. When I click show in finder it took me to the folder where I have my xcode project, and I puting there the folder downloded from this zip https://developers.google.com/admob/ios/download

Solved, I was putting the sdk folder and is the content of the sdk what you have to put, thanks for your help and your time

martinpelli commented 4 years ago

@gustavottc I done all succesfully but I can’t make the admob methods exists. I have to put something on the export template? If I have to put something there which file? Because I have like 10 files in the bin folder of godot

gumaciel commented 4 years ago

The AdMob only works on a real device, are you testing in a iPhone or iPad?

martinpelli commented 4 years ago

@gustavottc Sorry I am very noob. I don’t tested on a real device yet because of this: I installed the newer plugin of admob on android and I have an admob node with a script, so all methods exists, here I don’t have anything similar, so the godot debugger says that for example the load rewarded video method doesn’t exist, that why I am asking if I have to put something on the custom template on export settings, something that “detect” de admob methods

gumaciel commented 4 years ago

Oh, i think that i know what is going on.

Are trying to use this module on iOS and the other Module on Android, and this can cause incompatibility.

I created a new module that supports the new Android Plugin System and is compatible with iOS, so you can use for new Android and iOS will no problem, you can check here: https://github.com/Poing-Studios/GodotAdMob

p.s: is still on beta, but works nicely

martinpelli commented 4 years ago

Oh, i think that i know what is going on.

Are trying to use this module on iOS and the other Module on Android, and this can cause incompatibility.

I created a new module that supports the new Android Plugin System and is compatible with iOS, so you can use for new Android and iOS will no problem, you can check here: https://github.com/Poing-Studios/GodotAdMob

p.s: is still on beta, but works nicely

So you can use the admob node to for example load an ad on ios? Or how you can acces to the admob methods, thanks @gustavottc

gumaciel commented 4 years ago

Yes, to acess the AdMob methods you need to compile the Godot with the Admob module on modules/ folder

martinpelli commented 4 years ago

@gustavottc Ooh I think I am understandig what I am doing wrong, after compiling with the admob module, I am opening godot trough the bin folder, I have to open a new godot that I compiled with the module, the problem is that I don’t know which is becasue I have a lot of files with extensions .a .o and other stuff.

gumaciel commented 4 years ago

After compile the Engine with the AdMob module, you need to pick the ".a" file that has generated and then you need to overwrite this ".a" with the ".a" of your exported project game

martinpelli commented 4 years ago

image

That was what I did but doesn’t recognize the methods @gustavottc

gumaciel commented 4 years ago

You need to use AdMob.showRewardedVideo(), like: image

this is of example https://github.com/Poing-Studios/GodotAdMob

gumaciel commented 4 years ago

@martinpelli You got it?

martinpelli commented 4 years ago

@gustavottc stil trying... I download the example of the kloder module and get working everything, except that I can’t test it, I have and xcode error, so I am doing something wrong because without the module I don’t have this error image

gumaciel commented 4 years ago

I never saw this error, so strange, are you trying to test on a real device? like iPhone

martinpelli commented 4 years ago

I never saw this error, so strange, are you trying to test on a real device? like iPhone

Yes, on iphone 8 plus, if I export it without the modules its run perfectly, when I change the “.a” file and add the frameworks I can’t install it. I don’t know if the problem comes from the frameworks (maybe I am adding something wrong) or from the “.a” file but I tried with every “.a” file from bin folder after recompiling

gumaciel commented 4 years ago

Can you talk with me on Discord? I can help you with this more faster there, so, when we solve, we can put here what was the problem.

Put this String on Add a Friend: "Gustavo Maciel / gustavottc#5069"

martinpelli commented 4 years ago

"Gustavo Maciel / gustavottc#5069"

I can´t jajaja everything goes wrong for me, with your it say "Failed to add friend", try with my :MartinPelli#9828

gumaciel commented 4 years ago

Apparently the problem was solved alone, we don't know why he gave the error, when he was trying to help @martinpelli, in the first attempt without doing anything, the game installed in his game and he managed to play

martinpelli commented 4 years ago

Apparently the problem was solved alone, we don't know why he gave the error, when he was trying to help @martinpelli, in the first attempt without doing anything, the game installed in his game and he managed to play

Yesterday I discovered the problem, I have exactly 2 projects equals, one can been installed on my device an the other no, the only diference betwen the project that work was that in the export settings I have a different personal id (which worked without the module) so I don’t no why, it’s very weird but chnged it and worked, now I have a lot of crashes withe the module, I will try the solutions on the issues section. Thanks for your help offered @gustavottc

brendonion commented 3 years ago

Hi, quick question.. does this work with Mono? My mono version is 6.4.0.198. I've compiled the mono version of Godot (following this tutorial https://docs.godotengine.org/en/stable/development/compiling/compiling_with_mono.html)

And I've got to this point: scons p=iphone tools=no target=release arch=arm module_mono_enabled=true mono_glue=yes mono_prefix="$HOME/mono-installs/ios-arm64-release"

But it keeps giving me this error: modules/admob/ios/src/AdmobBanner.h:1:9:{1:9-1:42}: fatal error: 'GoogleMobileAds/GADBannerView.h' file not found [1]

Any help would be greatly appreciated. I've followed the above steps to a tee, but I just can't get it working.

Thanks!

gumaciel commented 3 years ago

Hi, quick question.. does this work with Mono? My mono version is 6.4.0.198. I've compiled the mono version of Godot (following this tutorial https://docs.godotengine.org/en/stable/development/compiling/compiling_with_mono.html)

And I've got to this point: scons p=iphone tools=no target=release arch=arm module_mono_enabled=true mono_glue=yes mono_prefix="$HOME/mono-installs/ios-arm64-release"

But it keeps giving me this error: modules/admob/ios/src/AdmobBanner.h:1:9:{1:9-1:42}: fatal error: 'GoogleMobileAds/GADBannerView.h' file not found [1]

Any help would be greatly appreciated. I've followed the above steps to a tee, but I just can't get it working.

Thanks!

What Godot version are you using? @brendonion

brendonion commented 3 years ago

3.2.3

gumaciel commented 3 years ago

@brendonion , i'm currently working on a new module for AdMob, check here: https://github.com/Poing-Studios/Godot-AdMob-Android-iOS

i will try to make a build by 3.2.3 version for mono on this repository

brendonion commented 3 years ago

Awesome, thank you!

Tobi-La commented 3 years ago

Hey,

I have the same error described in the title with Godor 3.2.3 and the most recent admob version 7.68.0:

In file included from modules/admob/ios/src/AdmobBanner.mm:1: modules/admob/ios/src/AdmobBanner.h:1:9:{1:9-1:42}: fatal error: 'GoogleMobileAds/GADBannerView.h' file not found [1]

I don't understand how the solution involving xcode should fix this, but I tried it anyway without luck.

How do I get rid of the error?