It looks like you're new here. If you want to get involved, click one of these buttons!
If you are interested in adding iAds to your exported projected then have a look at our latest tutorial at: http://codeatuts.blogspot.com.au/2013/04/tutorial-29-codea-v152-objective-c-add.html
Feel free to use in your own projects. Comments welcome.
Comments
@Reefwing, do you have a tutorial for iAPs?
Not yet...
I'll have a crack next weekend.
Awesome
@Reefwing I added iAds using the above tutorial and everything worked great until just recently I started getting an error where if I click on an ad in game, when I return to the game it causes an error and stops working. Do you know what's going on?
Sounds good. Still waiting for your in-app purchase tutorial
haha
@zapaper - yep. Just finished my Collision Detection tute. iAP is next. Everything takes longer than you think...
@JakAttak - are you pausing Codea when the ad is opened and then restarting it when the ad closes? You need to implement the ADBannerViewDelegate Protocol. This has two call back methods which tell you when an ad is opening or closing.
@Reefwing, is it supposed to pause and then restart? Because that's not what I want to happen. It should resume from where it was.
@JakAttak - sorry I meant pause and resume. Poor choice of words on my part.
I've gone back and checked the two apps that I have exported from Codea with iAds and they work ok when the ad is tapped and closed. However, I'm only showing ads on the menu screen so nothing particularly complex is going on. What error are you getting?
I use a finite state machine that saves the current "scene" as a variable screen and then do screen:draw(), screen:touched(touch), etc. after exiting an ad it says something like "trying to index nil value screen"
Sounds like your screen variable is being deleted or released somehow. I'm not sure what happens under the covers when the codeaViewController is paused - @Simeon may have some thoughts.
As a work around can you save the screen variables locally when an ad appears and then check if screen is nil and recreate it when the ad is dismissed?
How do you tell that an ad has been clicked?
That's when the method - (BOOL)bannerViewActionShouldBegin:(ADBannerView *)banner willLeaveApplication:(BOOL)willLeave - gets called.
But that's not a lua function is it? Do I need to add it?
hmm - thinking about this a bit more, I don't know a way to call a lua function running in the Codea sandbox from Objective C. I'm sure there is a way, I just don't know how to do it. The add-on functionality allows you to go the other way (call an Objective C method from Lua).
What you need is a register Lua call back method added to the CodeaViewController.
Alternately, if 2 new functions were added to Codea like viewControllerWillPause and viewControllerResumeFromPause, that would do the trick. However I suspect that isn't likely.
@Reefwing, after doing some more testing I realized that this doesn't happen in the simulator. So I'm wondering if maybe it's just my device... But I'm not sure
That's interesting, I only tested on the Simulator. Let me see if the same thing happens for me.
@JakAttak - I just checked the tute code on my iPad. It works ok.
Alright. Well, I'll test my app on another device. What really matters is that it works for everyone else
I am trying to add @Reefwing 's ads to my codea project in Xcode, but am experiencing some linking problems. I am very new to this, so probably an error on my part. I am trying to do it without the audio addOn.
I modified the AppDelegate.h and AppDelegate.mm as described in the tutorial.
I created a new file IAdsAddOn.h. From the tutorial it was not completely clear how or where to do this. The IAdsAddOn.h file is located just below the CodeaAddon.h (does it matter the order of the files in the Addons folder?)
The build reports the following errors...
Undefined symbols for architecture i386:
"OBJC_CLASS$_IAdsAddOn", referenced from:
objc-class-ref in AppDelegate.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I have checked numerous times the files are the same as in the tutorial (especially the use of capital I or small i).
Anyone have an idea how to fix this? I am stuck!
Did you include the IAd framework into your app? I bet that is the problem. Visit this link:
http://stackoverflow.com/questions/8845625/undefined-symbols-for-architecture-i386-building-for-ios
@austinmccoy Look at the last post date...I'm sure he's figured it out by now, or at least he's been posting some other things.
@austinmccoy Obviously he has figured it out, considering it is over a year old. It is still helpful to others though.
@austinmccoy wat.
Actually at the. time i didn't solve my problems with iads, so in the end i submitted my app 'circulation'
https://itunes.apple.com/gb/app/circulation-1/id695148887?mt=8
as a paid app. Consequently it had very few downloads!
Soon i hope I will get around to submitting my new app (LinkemUp)
http://codea.io/talk/discussion/comment/42019#Comment_42019
I will try to make this one free with iads. So thanks @austinmccoy for your suggestion, perhaps that was my problem.
Cool!