[DEPRECATED] Various Codea Objective-C Libraries

EDIT: Since the new Codea runtime in v2.1, these libraries no longer work. If you do make a fork of my library, please leave a link below and I’ll add it up here.

Hello, I've been putting it off for a while: Here's all the Objective-C libraries I've made for StackIt.


- [TestFlight](https://gist.github.com/Zoyt/7851580) - [GCAddOn](https://gist.github.com/Zoyt/7851595) (This is better garbage collection for Lua) - [GameCenterAddOn](https://gist.github.com/Zoyt/7851612) - [LocationAddOn](https://gist.github.com/Zoyt/7851620) - [SharingAddOn](https://gist.github.com/Zoyt/7851630) - [AppDelegate](https://gist.github.com/Zoyt/7851643) Please get the code from the actual source code of my game, StackIt, [here](https://github.com/Zoyt/StackIt).


1. Place the AppDelegate files in ProjectRoot / [your project name] 2. In AppDelegate.mm, put your project name in and your TestFlight key in 3. Place all other files in ProjectRoot / [your project name] / Addons 4. Tada!

Deleting files

1. Go to AppDelegate.h and delete the line that says `#import "filename.h"` 2. Delete the line that is `@property (strong, nonatomic) fileclass *vartitle;` 3. Go to AppDelegate.mm and delete the lines that say this: ~~~ self.vartitle = [[classname alloc] init]; [self.viewController registerAddon:self.vartitle]; ~~~ And then you're golden.

Other notes

- This is a live thread. I'm not done with these and I'll be posting updates. - GameCenter and sharing only work on iOS 6, not 5. I'll be fixing that later. - If you use this, all I ask is that you give me credit. - I created my own GameCenter because it doesn't use deprecated APIs, you can publish to custom leaderboard names, and you can show GameCenter banners - Make sure you enable GameCenter capabilities - My sharing file can also save to the camera role - Right now my sharing API only lets you share photos, but that'll change - Any other questions/requests/changes? Want to know how to do something I did in StackIt? Let me know.


Thanks for sharing! These will definitely come in handy once i migrate my project to Xcode / Codea Runtime

@JakAttak - No problem.

@Zoyt same for me thanks! (although i think i wont start publishing app befor 6-9 months… But then it will quite help me!

I just finished the ability to compose HTML email in-app (with a popup), ability to view other apps inside your app, and ability to go to the review link.
Now I’m working on alerts with multiple options and callbacks… Probably one of the more suggested features in Codea. Trust me, it’s not easy… Not to mention it’s 2:30 AM here. :expressionless:

It’s now 6:15 AM… I’m almost done, one last bug. I had to learn all sorts of crap about the Lua C stack (it’s horrible.) So I won’t be posting the libraries tonight. Probably in a while.

I finished the library. Now I just need to make it compatable with the current “alert” API and handle errors.

I’m looking into making a UI elements library. We’ll see how that goes… If I do it.

Sounds interesting

Hey there,

Alright, I’m at the point that i transferred all my stuff to Xcode and am trying to add these great plugins to the mix. I have a few basic questions though :

  • I only need Game Center and SharingAddOn, should I comment the lines referring to other add ons in the appdelegate files?
  • How do I call Game Center, or sharing for that matter, from the codea code? is there some templates I might have missed?

Thanks a lot, I’m excited to see how this works!

@Rodolphe, yes comment any code for the addons you dont include from the appdelegate files.

To call Game Center look in the add-on .m files where the functions are registered as lua functions - those are the names of the functions you can call directly from Codea code.

Thanks @JakAttak. Also, @Rodolphe, you can look at my latest repository, my game StackIt, which uses all these libraries. You can see what I do there. Just search the all the Lua code for “gamecenter”. That will who you everywhere I use the library.

Thanks @JakAttak and @Zoyt. I can’t see StackIt in your repository, did you release the code already?

@Rodolphe - It’s not in that repository (and that’s not even a repository anyways), it’s in another repository here: https://github.com/Zoyt/StackIt
Hope that helps!

Thanks a lot Zoyt, I’ll try and get game center to work in my game (credit is good, if I ever manage to make it work?)… Cheers!

@Rodolphe - Lucky for you, easy fix. This simply means that your provisioning profile doesn’t have GameCenter enable. So, to fix it, simply go to Xcode, then click on your project in the sidebar, make sure your app is selected as the target (which it probably is by default), then click “Capabilities” in the tab bar above the content. Finally, flip the switch on GameCenter. If that didn’t make sense/doesn’t work, LMK. I have another solution if this doesn’t work.

Hi @Rodolphe, this is ot, but there’s a little typo. Developed, not developped :wink:

Ok, I tried adding Game Center capabilities tonight. I:

  1. turned on GC capability in xcode,
  2. I added the m and h Game Center files in Addons directory
  3. I added the new AppDelegate files
  4. I inserted “authenticatePlayer()” at the beginning of setup(), “showGameCenter()” in the menu, when players press the GC button, and “reportScore(hscore,“Highest elevation”)” when a game is over and the best score has been beaten

I’m getting this message, do you think I missed something?


Oh thanks for the typo!

Sorry, what do you mean “this is ot”?

I meant that my comment was off topic
with regards to the question you’ve originally made, sorry for not saying that in the first place @rodolphe