It looks like you're new here. If you want to get involved, click one of these buttons!
This post is for people who are currently building exported apps with Codea 2.0 — especially those who experience issues on iOS 8 (camera permission requests, for example).
It is also for people who are happy to mess around in Xcode to upgrade their projects, and for people who want to test and provide feedback.
You can download a zipped Xcode project here:
http://codea.io/prerelease/MyProject.zip
"MyProject" is a sample Xcode project that builds using the new Codea 2.1 runtime.
Some notable changes for Xcode projects:
CodeaViewController
has been replaced by StandaloneCodeaViewController
. This is a light wrapper that was required to simplify the startup sequence due to the new threaded nature of the runtime.CodeaAddon
classes now have some more stringent requirements relating to threading (detailed below)GameCenterAddon
that implements basic high score and leaderboard functionality. Not very well tested, but it should give you the basics of how addons work (see the Addons/Extra folder in Xcode).AppDelegate
is implemented (to follow this one), replace your CodeaViewController
with StandaloneCodeaViewController
and modify your addons accordingly. Make sure you branch before you attempt the upgrade in case things go wrong.Because Lua now runs on a separate thread, any callbacks into your CodeaAddon occur on the Lua thread. If you want to touch UIKit you'll have to dispatch_async
to main. (See GameCenterAddon.m line 207 for an example function that does this.)
Of course, this version of the runtime includes all new APIs that will be included in Codea 2.1 (some APIs are deprecated but still functional, such as spriteList
).
Edit: Codea 2.1's will likely include basic addons when you export projects. If you want to contribute to addons (bug fixes, or whatever else) there is a github repo here: https://github.com/TwoLivesLeft/Codea-Addons
Comments
Thanks a lot !
Hi @Simeon,
If we use the Testflight 2.1 beta, do we get all this as standard on an export?
Thanks
brookesi
@brookesi no — that one still uses the 2.0 export. It will be in the next beta.
Whoops! Missed this discussion. If I were to fork the Codea Addons repository, would you consider adding some libraries I have written?
Thanks!
@Zoyt certainly, however please keep in mind that they require use of a slightly newer API and that all Lua functions will be called off the main thread.
@Simeon - Alright. If I have a bit of extra time, I'll be sure to adapt them.
Thanks!
Boo! Hi guys. Long time no see. Sorry - been working 60 hour weeks, for well over a year now. Is crazy.
Just a note to say this is the first time a project just worked for me out of the box. Impressed as always, and thank you again for releasing a runtime. (I had an epiphany - if I have an oddball request, I can just modify the runtime. In this case - I need to use a client side SSL certificate, so I can talk to a docker server. Yeah, I finally sprung for a developer's membership, yay.)
@Bortels - Great to see you back! Also, not sure you can really modify the runtime. You can make add ons, but you can't actually modify it. It's already compiled code.
Okay, feeling much like an idiot here.
I downloaded the sample project, renamed it to the name of my project, copied in my lua code and asset pack, did the provisioning profile shuffle, and when I compile it... it comes up with a screen like Codea running a blank main.
What am I missing? Is there something else I need to edit to get my lua code to execute?
@Mark Have you tried editing the Info.plist to specify what tabs there are, and their order?
@SkyTheCoder The info.plist within the program.cdea folder? Yes, it has all the classes detailed.
Found it. Needed to change the .codea name in the AppDelegate
However, I'm still having a trouble with location services. While it now works fine within Codea, when I compile the app doesn't ask about location services and when I look in settings, it doesn't appear in the list of apps that have location services available.
Should have mentioned this earlier...
Adding NSLocationWhenInUseUsageDescription, Privacy — Location Usage Descrption, and NSLocationAlwaysUsageDescription to the Custom iOS Target Properties build settings got GPS functional again. However, to get the apps running, the user still has to go into settings and turn on the location services for the app as no prompt for location services is appearing.
@Simeon My app got rejected because of the camera access bug in 2.0, so I'm trying to figure out how to get the iAds addon to work with 2.1. However, I'm having trouble figuring out how to use the iAds add on with the new runtime. It worked great with 2.0 version, but I can't figure out how to use it with the way the new 2.1 runtime works.
I tried changing the appdelegate.h by adding
Then in appdelegate.mm adding
That is about all that had to be done in 2.0 to get the add-on to work, but i'm getting linking errors in Xcode now with the 2.1 runtime.
Below is the actual iAds add-on code:
IAdsAddOn.h
IAdsAddOn.m
@Mark I think you have to set the correct keys in the info plist file of your custom application. I will look them up and let you know what to set.
@Crumble your Lua functions are now called outside the main thread, so you'll have to modify any code that touches UIKit to be dispatched to the main thread.
Here's an example of changing one of your Lua functions:
@Mark the key you will need to add to your info.plist file is:
NSLocationWhenInUseUsageDescription
Make it a string, this message will be used when the request alert to use location services is displayed.
@Simeon Thanks for the info! The iAds add-on is one that someone else made, I just plug it into my project in X code, objective C is totally over my head. Do I just need to add that dispatch_async line to any lines that do the BanneViewAnimated? Is there anything else that I need to change in the objective C code to get it to work?
Hopefully there is an iAds add-on in the final 2.1 version, iAds are one thing that pretty much every app uses.
Also, when using the 2.1 runtime, I notice that Gamecenter tries to authenticate the player automatically, even if I don't have Gamecenter in my app. Is there a way to turn off the authentication?
Sorry for all of the questions.
I just want to say that I love Codea, thanks for making it!