I could use some help here to integrate Admob for the iOS version of my game. I have no flipping idea of iOS native programming. My libGDX game was written with Android in mind, nonetheless I have successfully build it for iOS with MOE. Everything is working. Well, everything except Admob that’s my main income source so I really need to set it up.
I have seen some posts here about this matter, but none that have helped me. There’s one code example someone published, but it won’t even build because there’s a call to a constructor with different parameters than the constructor declaration itself, so I don’t think is too reliable.
I think it someone could just give me a comprehensive list of steps I should follow and/or concrete things that I must research, I could do my own way from there.
make the binding (use the one provided by the MOE team, but in the first field, that should be something like “main/java/org/…”, remove the first two folder, so it becomes something like “/org/moe/…”)
download some of the sample project found on the internet and copy the code
Ok, I see, I need the cocoapods, but I don’t seem to find a pod file in my project, so I’m going to make it with the zip file downloaded by hand instead.
Ok, wait
Sorry but when i answered you I was with my phone, so i couldn’t be very accurate
Since you prefer the direct download of the framework, i’ll give you a more detailed version of the steps:
Download the GoogleAds Framework from the internet (be sure to download the iOS version)
Inside your ios-moe module, create a folder named “framework”, and then add the googleads.framework file inside of it
Now it’s time to generate the binding. If you search on google, moe stuff released on Github a series of “binding.nbc” files, one for each of the most used third party framework (and in fact, there’s one also for Google Ads). Download the relative binding.nbc of the Google framework, copy it inside the ios-moe module, and double click on it (if you are on IDEA, it should open a .nbc editor). Everything on that file is good, but remeber to change the source folder of the framework and change the “output” to just “src”. And lastly, click on the steam -> Generate Binding
If no error relative to Google Ads is show, all should be good, and now you can start writing the code, inside the IOSLauncher, to initialize your Ads
Last thing: remember to add the googleAds framework in the build phases inside the xcode project, together with the other frameworks needed (to see all the frameworks, simply open the project i’m linking you below)
P.S. : To see how to implement ads, you can easily understand how following the official google ads guide for iOS, and remember to update moe plugin to 1.4.4 (inside build.gradle)
I shouldn’t have forgotten anything, but if u get any error, just show me
Below “Keep generated Natjgen files” (above the + and the - ;near the “GoogleMobileAds” text) there’s a “steam wheel”, if you click on it, the “generate binding” option pops up
Oh! I see now… thanks for the clarification! I shouldn’t code without wearing my glasses…
Nonetheless, it says “failed to locate platform SDK (iOS)”.
I’ve double checked that the framework files are there. I have even selected them directly with the three dots button, so they are there, that’s for sure.
EDIT: I solved this particular issue thanks to the last message in this post:
I’m getting the following errors when trying to run it in the emulator, but I think it’s proguard related:
/Users/rolandvigh/public-repo/moe/natj/natj/src/main/native/natj/ObjCRuntime.mm:1478 WARNING: Binding class refers to class GADBannerView, but it can not be found. Fallback to indirect super class.
/Users/rolandvigh/public-repo/moe/natj/natj/src/main/native/natj/NatJ.cpp:1650 FAILURE: C variable not found for method kGADAdSizeFullBanner in class org.moe.binding.googlemobileads.c.GoogleMobileAds!
I copied the contents from the proguard.append.cfg file of the example into my proguard.append.cfg but it made no difference at all. I’m gonna call it a night, let’s see if tomorrow I get this finally working.
Tried adding -ObjC to the linker parameters, then I got this different problem, that I don’t know if it’s an improvement or the opposite…
Undefined symbols for architecture x86_64:
“_inflate”, referenced from:
_GADNInflatedDataFromBytes in GoogleMobileAds(GADNDataCompression.o)
“_inflateEnd”, referenced from:
_GADNInflatedDataFromBytes in GoogleMobileAds(GADNDataCompression.o)
“inflateInit2”, referenced from:
_GADNInflatedDataFromBytes in GoogleMobileAds(GADNDataCompression.o)
“_sqlite3_bind_text”, referenced from:
l059 in GoogleMobileAds(GADNSettings.o)
l026 in GoogleMobileAds(GADNSQLStorage.o)
“_sqlite3_close”, referenced from:
l004 in GoogleMobileAds(GADNSettings.o)
l006 in GoogleMobileAds(GADNSettings.o)
l004 in GoogleMobileAds(GADNSQLStorage.o)
l006 in GoogleMobileAds(GADNSQLStorage.o)
“_sqlite3_column_text”, referenced from:
l005 in GoogleMobileAds(GADNSettings.o)
l005 in GoogleMobileAds(GADNSQLStorage.o)
“_sqlite3_errmsg”, referenced from:
l059 in GoogleMobileAds(GADNSettings.o)
l026 in GoogleMobileAds(GADNSQLStorage.o)
“_sqlite3_exec”, referenced from:
l006 in GoogleMobileAds(GADNSettings.o)
l006 in GoogleMobileAds(GADNSQLStorage.o)
“_sqlite3_finalize”, referenced from:
l005 in GoogleMobileAds(GADNSettings.o)
l059 in GoogleMobileAds(GADNSettings.o)
l005 in GoogleMobileAds(GADNSQLStorage.o)
l026 in GoogleMobileAds(GADNSQLStorage.o)
“_sqlite3_open”, referenced from:
l006 in GoogleMobileAds(GADNSettings.o)
l006 in GoogleMobileAds(GADNSQLStorage.o)
“_sqlite3_prepare_v2”, referenced from:
l005 in GoogleMobileAds(GADNSettings.o)
l059 in GoogleMobileAds(GADNSettings.o)
l005 in GoogleMobileAds(GADNSQLStorage.o)
l026 in GoogleMobileAds(GADNSQLStorage.o)
“_sqlite3_step”, referenced from:
l005 in GoogleMobileAds(GADNSettings.o)
l059 in GoogleMobileAds(GADNSettings.o)
l005 in GoogleMobileAds(GADNSQLStorage.o)
l026 in GoogleMobileAds(GADNSQLStorage.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Honestly, this is quite frustrating. I’m gonna give MobiDevelop a chance. I think it cannot be worse.
I can’t really help you with that, using Pods doesn’t give this error, idk why u get it
I don’t recommend using mobidevelop since it’s abbandoned
But yeah, might worth giving it a try