StandaloneCodeaViewController implementation

Hi everyone,

I’m going through the finishing touches on an app I’m hoping to release soon and am inserting ads using the StartApp platform.

The method for inserting banner ads requires editing the ViewController.m (implementation) file in the runtime, however the Codea runtime only has a StandaloneCodeaViewController.h (header) file. I’ve attempted to create an implementation file titled StandaloneCodeaViewController.m but this has caused errors during the build.

Does anyone have experience implementing ads or accessing the ViewController in this manner? I appreciate any help anyone can offer.


What code do you need to add to your view controller implementation?

You could subclass StandaloneCodeaViewController and instantiate your subclass from the AppDelegate. Then any new code could live in your subclass implementation. I haven’t tried this but it might be the place to start.

Hi @Simeon thank you for the response (and sorry for being slow with mine over the holidays)!

All I need to add is a line with:

[STAStartAppAdBasic showAd]; 

in Xcode when I want it show up. Obviously this is complicated because of how the Lua code is wrapped when exporting from Codea. Using Codea is really my first experience with coding so I am still learning about how the exported project interacts with Xcode.

A better question may be is there any way to implement Objective-C functions within an exported Codea project? i.e. if a user finishes a level and I want to call the above function is that possible? Even if there is not a quick and easy solution let me know if there are any resources that you think may be helpful for me to learn more about how Codea projects work within Xcode.

Thanks again!

@cmingo I know where you’re coming from, because I was at the same place as you about a week ago. The way I did it to be honest is I taught myself on the spot. My best advice is to look at gameCenterAddon.h and gameCenterAddon.m and AppDelegate.h and AppDelegate.m and see how they interact. I do plan on posting a video, but you’ll probably figure it out before I do so. Best of luck!

@CamelCoder Thanks for the advice! I figured it would take some self learning but just didn’t know where to start. I’ll start looking at those files and hopefully be able to work it out!