Hi, I am currently working on Game Center integration in GLBasic, and some help would be fine.
Inside the ZIP, there are 2 folders:
- GameCenterWrapper: here is the source code for XCode, it is yet incomplete because I want to test before.
- GCTest: a simple GLBaisc project to test it.
I thnk each function is self-descriptive, with a notation about "lastErrorCode", as access to GC is asynchronous, we need a way to know when has been completed in GLB, then I use the lastErrorCode for that, I set it to -1 while working, and when is <>-1 we can see the result (see source code of GCTest). For NO ERROR, lastErrorCode passes from -1 to 0 (0 is NO ERROR). I think there is no error =-1 in Apple documentation, for that I use it, if there is any, simply change it.
With GCisSupported + GCisAuthenticated + GCgetLastErrorDomain + GCgetLastErrorCode IMO there is full to know about if there is success or any error, only looking at Apple documentation. In example, if GCgetLastErrorDomain="NSURLErrorDomain" this is internet connection problem, look at Apple docs for more info.
Well, after this, what I need are testers, Game Center doesn't works on jailbroken devices for development purposes, so you need an original iOS device with Game Center support.
In the simulator it works perfectly, I have tested on a jailbroken device (it is not mine) and it says "This game is not recognized by Game Center", this is GOOD because it seems that it tries to authenticate, and this is exactly what should be seen on jailbroken devices for developer compilations (including AdHoc ones), but for better results, it would be good that someone with an original device test it.
- Create a project with Game Center in your iTunesConnect, you can use any name, as they are going to expire, I recommend something like MyDomainGameCenterTest01, so when expires you can use MyDomainGameCenterTest02, etc, etc. Get all needed certificates and blahblah (see at Apple documentation).
- In XCode: once we have our XCode project from GLBasic, simply follow these steps:
1) Add GameKit framework to frameworks. Before this you need to select the "Release" configuration.
2) Add the folder "GameCenterWrapper" to the project, i.e. in "Other Sources" section.
3) Configure you target settings, in "Properties" set the "Identifier" to your APP ID, remember that wildcards doesn't work for Game Center.
4) Build and Run IMPORTANT
: remember to create a Sanboxed Game Center profile for testing purposes. this can be done by logout with the current profile and then starting the Game Center development app, and click on Create New, use a new e-mail that will be attached to an Apple ID by its own with a verification mail, so there is no need to create an Apple ID for this before, simply a non-used email by other Apple ID.
Comment here if it works (you see the Game Center authentication notification). Modify the GCTest or create your own for deeper tests.Note:
the files to modify are the GameCenterWrapper.h and .m, and maybe the GameCenterWrapperFunctions.mUpdate: lastest code in the attached file, including an example project.