Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat | DONATE
Ads interface questions — Gideros Forum

Ads interface questions

velobuffvelobuff Member
edited March 2015 in Bugs and issues
I'm trying to follow instructions for including AdMob ads in my project at http://docs.giderosmobile.com/interface/ads and am confused.
1. Why do we have to add the stuff to our exported Xcode project *before* we insert the lua code? If I have to add lua code, then don't I have to export my Lua project to Xcode *again*???
2. Is my Lua code expected to run in Gideros Player after I add the ad stuff i.e.

--require plugin
require "ads"
--initialize admob
admob = Ads.new("admob")
admob:setKey("key")
admob:showAd("auto")


3. The lua code require 'ads' gives an error when I try to run my project in Gideros Studio. Why? I'm assuming an "ads.lua" file must need to exist somewhere. Where do I get this file? Do I have to be a paid member? I assumed that since Gideros went Open Source, you didn't specifically have to (especially since I noticed my TestFlight app doesn't show the Gideros Splash Screen on startup on my iPhone).

This page http://docs.giderosmobile.com/interface/main says "yes" but the button for Indie Developer which goes to this page gives a 404

http://members.giderosmobile.com/clientarea.php?action=products#upgrade

3.5 This page implies that the code is in Labs - Is it? http://docs.giderosmobile.com/reference/labs/Ads#Ads

... so I can't upgrade. But everyone seems to have access to all the Github Gideros Plugins at https://github.com/gideros/giderosplugins

4. This page http://docs.giderosmobile.com/interface/ads says "Copy contents of Plugins directory into your exported project's Plugins directory" -- Where is the first/source Plugins directory? I can see my Xcode projects plugins directory but there is no directory named "Plugins" in the github plugins. Do they mean *ALL* the plugins (including Ads, Facebook, Flurry, Store Kit, GooglePlay, etc..etc..etc..?)

5. I've tried to execute the example in the Ads plugin directory but I get the error at "require 'ads' " line.

Is there a beginner's tutorial somewhere? I've read as much as I can on this forum but I seem to be missing something critical at the start.

Thanks!

Comments

  • ar2rsawseenar2rsawseen Maintainer
    Accepted Answer
    Sorry, I know it is confusing since we moved to open source :)

    But what you need to do, is to build a Gideros Player from Xcode or Eclipse project with Ads plugin preinstalled and then you can run your lua code with require ads on it


    http://docs.giderosmobile.com/deployment.html

    Check Device player with plugins
  • simwhisimwhi Member
    Accepted Answer
    @velobuff

    Lots of questions...

    1. You need to add the plugin to your exported project before you can add and test the Lua code.

    2. You will need to build a custom Gideros player (with plugins) to test your Lua code.

    3. The require "ads" is used to reference the plugin. It's not a Lua file.

    3.5 The plugins are on Github.

    4. I'm not sure about the procedure for XCode as I'm only using Android at the moment.

    5. Refer to point 2 and 3 above.

    I didn't find a specific guide for ads. I had to look around a lot on the forum to get this working. It's worth it in the end though.

  • Success. @ar2sawseen and @simwhi were both correct!

    Here's what I did from the very beginning:
    0. turn my mac (osx 10.9.5 Mavericks) on
    1. download gideros 2015.2 from https://github.com/gideros/gideros/releases
    2. download Xcode (Version 6.1.1) from apple App Store for mac. Make sure your Provisioning profiles/etc... is all set up.
    3. download .zip of Gideros plugins at https://github.com/gideros/giderosplugins
    4. on my local computer, unzip /Applications/Gideros Studio/GideriosiOSPlayer.zip
    5. unzip # 3
    6. copy #3's /Ads/source/IOS/Plugins/Ads folder into #4's GiderosiOSPlayer/GiderosiOSPlayer/Plugins folder (so that now there is #'s Ads folder inside the Gideros Xcode project
    7. Delete everything in Ads/frameworks EXCEPT AdsAdMob.h AdsAdMob.m GoogleMobileAds.framework
    8. Open GiderosiOSPlayer/GiderosIosPlayer.xcodeproj in xcode
    9. Right click on my project name -> Add Files to GiderosIOSPlayer -> then browse to the Xcode project -> Ads folder you copied in #6. make sure "Create groups" is selected. Then hit "Add". Notice a new "Ads" folder in your Xcode project.
    9. Look at http://docs.giderosmobile.com/interface/ads -> Installation iOS tab scroll down to "AdMob" section. Notice the left hand column says all these additional frameworks you have to add to your project (They come with XCOde). So in Xcode
    10. In xcode, click on my project name then select "Build Phases" -> open up the section "Link Binary With Libraries" . At the bottom of that section click "+". Select all 10 (one by one) and click "Add". Repeat for

    AdSupport
    AudioToolbox
    AVFoundation
    CoreGraphics
    CoreTelephony
    EventKit
    EventKitUI
    MessageUI
    StoreKit
    SystemConfiguration
    (per the Gideros documentation in 9)
    11. Go to "Build Settings" -> Search bar -> type "Modules". in "Apple LLVM 6.0 - Language -Modules" settings ensure "Enable Modules (C and Objective-C)" says "Yes"
    12. Select a suitable iOS SImulator and click PLAY. It should build and run. Leave the simulator running.
    13. Open up Gideros Studio. Create a new project. In main.lua type

    ads = Ads.new("admob")
    ads:setKey("xxxxxxxxxxxx")
    ads:enableTesting()

    ads:showAd("auto")



    14. In Gideros Studio click Player -> tick "Localhost" -> OK. Then click PLAY. You should see a "Test Banner" banner ad at the top of the Xcode/iOS simulator (DO NOT TRY/you CANNOT USE the Mac's Gideros Player -- your iOS Simulator is at "localhost").
    15. Close the iOS Simulator (hit STOP).
    16. Then connect your iPhone to your Mac. Then Select your iPhone in the Xcode Menu and hit PLAY to install the new Gideros Player on your iPhone.
    17. Close Xcode.
    18. In Gideros Studio, hit Player -> add the IP of your iPhone. on your iPhone, start the patched GiderosiOS Player. Wait a second. Hit PLAY in your Gideros Studio. A real banner ad should show up at the top of your screen in your patched Gideros IosPlayer!
    19. Have a glass of wine!
    ads.png
    1280 x 800 - 559K

    Likes: bali001

    ads.png 559.2K
    +1 -1 (+1 / -0 )Share on Facebook
  • More Proof.
    IMG_4970.PNG
    640 x 1136 - 103K
  • @velobuff Well done!! I'll follow your instructions when we start testing our game on iOS.
  • DikkesnoekDikkesnoek Member
    edited September 2015
    Hi velobuff,

    I've tried your tutorial but I will get errors in XCode. I am using the latest XCode
    7 and Gideros Studio (2015.09). There is a header file (gideros.h) missing. When
    placing this file (found on Github) in the Ads/framework folder I will get more
    errors of missing files. Am I using wrong versions?


    Thanks,

    Marc
Sign In or Register to comment.