Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by fulvio

I've included the following in my main game init:

gameCenter: null,
init: function() {
    // Authorise Game Center.
    this.gameCenter = new Ejecta.GameCenter();
    this.gameCenter.authenticate(function(error) {
        if (error) {
            console.log('Game Center Auth failed');
        } else {
            console.log('Game Center Auth successful');
        }
    });
}

I then call the following code later on in the game:

if (this.gameCenter.authed) {
    // Report Achievement 'bleh' with 100% completion.
    this.gameCenter.reportAchievement('091238715292', 100, function(error) {
        if (error) {
            console.log('Reporting the achievement failed');
        } else {
            console.log('Achievement successfully reported');
        }
    });
}

The problem is that as soon as the game starts up I get the following error.

* Terminating app due to uncaught exception 'UIApplicationInvalidInterfaceOrientation', reason: 'Supported orientations has no common orientation with the application, and shouldAutorotate is returning YES'
* First throw call stack:
(0x3b6ac3e7 0x36211963 0x3b6ac307 0x36e7a84f 0x3701ef21 0x36efecd5 0x36efdf63 0x3b6afad4 0x3b60728f 0x3701c0f3 0x339dde01 0x3462a793 0x3462a5db 0x3462de45 0x3b6801b1 0x3b5f323d 0x3b5f30c9 0x3b4de33b 0x36e66289 0xaedbb 0xaed60)
libc++abi.dylib: terminate called throwing an exception

1 decade ago by dominic

This seems to be a bug in iOS6.

In your project settings, did you select any of the Supported Interface Orientations? Don&039;t do that! Keep them all unselected <2> and instead only set the _Initial interface orientation_ (again, *not* the _Supported interface orientations_) in your #Resources/*-Info.plist.

1 decade ago by fulvio

@dominic: You're right unfortunately. It is a bug.

I ensured my Supported Inteface Orientations were landscape (home button on the right; I chose) and unselected them like you said within my project and it&039;s now authorising and reporting achievements successfully (I can see these achievements by calling #ig.game.gameCenter.showAchievements(); from within an entity just fine).

On that note though - I don't know whether it's actually functioning properly in terms of reporting. Every time I report an achievement with 100% success I can report that achievement again and again.

Is this proper Game Center functionality that you can report a 100% achievement over and over or do we have to store this record in localStorage and check to see whether it's already been achieved or something? I thought Game Center recognised that an achievement was already met and never reported it again.

1 decade ago by dominic

You're right, this makes no sense. I will implement something that checks if the achievement was already reported with the same percentage before reporting it again.

1 decade ago by dominic

The current version on github now reports achievements with the same percentage only once.

I also add a .softAuthenticate( [callback] ) method. If the previous auth was successful, this function will automatically log you in; if the previous auth wasn't successful (or never attempted for this game), this function will do nothing.

The idea is that you can call this method as soon as the game starts and have an extra button on your title screen that calls the normal .authenticate( [callback] ) method. People who don't want to use GameCenter, will not be annoyed by a login screen at every game start and everyone who previously logged in, will be logged in automatically.
Page 1 of 1
« first « previous next › last »