It looks like you're new here. If you want to get involved, click one of these buttons!
I have completed a new tutorial on implementing iAds for your Codea app using the runtime. It is fairly straight forward and includes a new function called showBannerAd(true or false).
You can access the tutorial at http://codeatuts.blogspot.com.au/2012/11/tutorial-23-implementing-iads-with-codea.html
As always, comments welcome.
Comments
I keep on getting an error with this last line:
I think the problem is that I'm not using Game Center for this App. Do I need follow your Game Center tutorial for this bit to work?
Hi @veeeralp - no you don't need to use Game Center. What is the error? You do need to use the aGameCenter_Codea class though.
.@Reefwing I added everything I need and now i get this error. Here's a screenshot:
http://d.pr/i/2he1
I already put
into the Main.lua
Edit: I went on to replace all the code I had for the files you listed in the tutorial. The only errors I have now are these:
I'm still trying to learn objective c so I'm not entirely sure what they mean.
Hi @veeeralp - you would get the error in the screen shot if you hadn't added displayingAds and the new call back method iAdDisplayStatusChanged in CodifyAppDelegate.h and CodifyAppDelegate.m.
The second lot of errors are probably because you haven't linked the Game Center framework called GameKit (which is perfectly reasonable since you aren't using it). Either delete all the references to the Game Center code (anything which starts with GK requires GameKit e.g. GKLocalPlayer) or it may be easier to just link the framework (instructions here: http://codeatuts.blogspot.com.au/2012/09/tutorial-19-integrating-game-centre.html) like you did for iAds.
My apologies, I should have mentioned this in the tute and will update it.
.@Reefwing Thanks for the tips! I got the simulator working without any errors but I can't see the iAds in the simulator or on my device. I have the iPhone 5 so maybe that's the problem. It's probably getting cut off. Any way to make it always show iAds while testing?
.@veeeralp - iPhone 5 shouldn't be a problem and it works in the simulator as well. You need to give it a while for the ad to be served up. I assume you have activated iAds for your App in iTunes Connect?
Go into iTunes Connect -> iAd Network and you should be able to see your App with the status "Test Ads".
If that isn't the problem then you need to give me a bit more to go on.
.@Reefwing The status does say "Test Ads" Are there any changes I need to make to the Code Signing. All I did was move the files in your Dropbox to my Xcode Project. Are there any unique identifiers I need to replace? Can I send you a link to my project via PM? I'll send it to you once I get home
.@veeeralp - no the unique identifiers are only for the Game Center code. Send it over and i will have a look.
.@Reefwing sent! Thanks for the help
.@Reefwing I sent you a PM again. This time I put the files in Dropbox
Thanks .@veeeralp - I'll check it out when I get a chance. I'm travelling all this week.
I had a quick glance at the Lua code and couldn't see anything obvious - looks like you want to have ads showing all the time. I can't actually run your app because the ads are linked to your iTunes Connect account. It would help if you could narrow it down a bit (e.g. can you check whether your ads methods are being run in Xcode? Put in some NSLog statements to check).
.@Reefwing Some ad methods are working. Here's what I got:
In the console, iAds did load does show up, however iAds are now working doesn't show up. Is there anything else I need to check? Don't worry about taking too long. I have time because school gets in the way.
.@veeeralp - ok that helps. The good news is that your App is getting served ads. The problem appears to be with the displayingAds boolean. Can you do some logging to check that this is getting set to true by your Lua code? Alternatively, since you are displaying ads all the time just hard code this to true in Xcode. That will at least narrow the problem.
.@Reefwing I did some logging and I can confirm that showBannerAd is getting set to true in the Lua code. Here is what I did:
I have no idea what the problem is now. I utilized all the source code you provided. My paid version got approved and I'm waiting to finish this so I could release both at the same time. Hoping to launch before Christmas
.@veeeralp - you need to check the boolean displayingAds in your Objective C code. As a start just make the first line of the method - (void) iAdDisplayStatusChanged:
displayingAds = YES;
and see whether the ads get displayed. If they do, then the problem is in setting this boolean from Lua. It could be to do with the timing. I set banner ads to true after the splash screen fades while you do it pre-setup.
.@Reefwing I put what you said and put it in a_GameCenter_Codea.m. I get an error and it says "use of undeclared identifier "displayingAds". I never remember putting this in my code before. This seems to be the problem
.@veeeralp - the method - (void) iAdDisplayStatusChanged is not in the aGameCenter_Codea.m file it is in the CodifyAppDelegate.m file.
.@Reefwing I did what you said and I still doesn't show the Ads
I'm beginning to think I should start a new Xcode project and do everything over
.@veeeralp - I suspect you are actually close to getting it to work. What do the logs show? You need to follow the program flow and identify where the problem lies. Are the:
statements being called in (void) iAdDisplayStatusChanged?
.@Reefwing Nope. Those statements are not being called in the console. Maybe the version of the Runtime I have has to do with it? The one I'm using is from August and has been updated a lot since
This is what I put:
I still don't know why it doesn't work
.@veeeralp - well what you know now is that the method iAdDisplayStatusChanged is not being called, which is why the ads are not being displayed. The next question is why is it not being called?
Go into aGameCenter_Codea.m and find the showBannerAd method. Add an NSLog message into that, something like what is shown below. If showBannerAd is not being called then the problem is in your Lua code.
.@Reefwing Nothing shows up in the console pertaining to aGameCenter_Codea.m. I have showBannerAd set to true in 3 different places in my Lua code. I put this in my Lua Code
And the console does show that Ads in Lua are indeed working.
.@veeeralp - try this, in the CodifyAppDelegate file, find the method - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions and insert the two lines shown below.
.@Reefwing I tried this and the NSLog statements are now working. However, I can't see my app or the ads. All I have are the NSLog because the screen turns black when testing on my iPhone. Here's what the console shows:
.@veeeralp - that's weird. Rather than continue to chew up forum space I will PM you.
Any ideas for when the showBannerAd(bool) seems to not control the ads at all. I can do the code you showed above to have it always on, so I know the framework works, but the function does not seem to work for me.
Hi @smile4awile - the simulator will only show ads sometimes (which emulates the real world situation), but I assume you have tested this a few times so that is probably not the issue.
You need to narrow down the problem a bit using some log statements. From what you have written it appears that your issue is not being able to show/hide ads from Lua. First double check that the showBannerAd bool is being set to true in Lua, then check whether that value is being transferred to the Objective C displayingAds bool.