Friday, August 30, 2013

iAd in iOS with Marmalade (on PC), what a pain

Ok, so the title does describe what I think. Though it is not all bad to be honest.

Let me explain a bit more...

I went to iTunes Connect and clicked the easy to see button to activate my iAds for my game (click ya game under manage apps, then the button is top right side). It was very easy to activate as ALL you had to do was confirm you were activating them and then save it. Done on the Apple side of the setup equation (this made me hapy, no stupid IDS or codes to put into my code to make sure I was serviced ads).

Next up was to work in the code from Marmalades example. I have to say that it was pretty easy to use. Setup the MKB(project) file with the iAds extension and then grab the relatively few routines I required and placed them into a class for use in my game. Once again, very easy to setup and this did not take me long at all. Then it was time to run the code.

I setup some of my title page buttons to do an extra task, so activating the config button would tell the Ad to show, activating the shop button will hide the Ad. I also added in several debug prints to the screen to tell me what state the Ad system was in. I wanted to know that I had Ads ready to go or not, and then if they were Showing or Hidden. So far so good. In fact it was still good till I ran the game and saw that an Ad was active and I touched the config button to Show the Ad. That is the moment things went awry.

The Ad appeared at the top of the screen, which was ok, I don't really mind it being there, though I would prefer the bottom once I get them working, or that was my thoughts anyway. However there were problems. Namely the screen should have shrunk vertically to fit in the Ad, but it didn't. Instead it pushed the whole screen down and so I lost a bunch of screen off the bottom. Also the touch input should have been shrunk to the newly sized screen, and apparently it did, only now it didn't matchup with my graphics as they were pushed down, Gah! If they had match I could have worked around this issue easily enough, but not now.

So I went looking for how to set the Ad to a different part of the screen, and I read the help info on the iTunes developer site and was excited to see so many options of where to place it, and also what sizes of Ad I could place. I found out later when I looked all over Marmalade that the extension doesn't actually support different placements for the iAds. Ahh well I figured I only really need one, but one that works. After reading all over the place on the internet along with the Marmalade Dev forums (obviously). I discovered this problem has been around for more than 2 years. So the chances of it being fixed is small. I presume it isn't addressed because there really are very few complaints about it not working. But there is a bunch of good news.

The Good news is that there is a was around this. Firstly it is said that if I had the Ad working on the bottom the screen would shrink along with the touch input and so the Ad would seamlessly be part of the screen it shows on. Great.. but how do I get the Ad on the bottom of the screen. It seems that all I have to do is modify the .mm file and rebuild the extension libs. Well sadly for me developing on a PC I can only rebuild iOS libs on a Mac. The actual source files for the library I found on Github here. So it should be possible to get a fix for this. I have asked a couple of mates, but they do not really know how to rebuild libs on a Mac, and the same for me at this point. I will have to read up on that once I have my current tasks sorted out. I really would like to have the iAds working in this game, to help supplement the games income.

I hope this blog post helps others in my situation understand what is going on with the iAd in Marmalade and its problems. If there are more problems, I have yet to find them, but I will post once I do.

Da Voodoochief


  1. Where you ever able to have this problem fixed?

  2. Hi Mike,
    I was not able to get this fixed. However I have seen some movement/noise in the Marmalade forums about it being fixed by Marmalade. I hope this turns out to be a fact at some point. Instead I am using iwgameads still.

    so, 7.22 or 7.3 will have a fix??? We shall see, and I won't hold my breath.

    Da Voodoochief