[Resolved] Gamecenter.Init() on iOS 6

I have three different devices that I have tested with Gamecenter.Init() and they the functionality does not seem consistent on each one. Is this happening for anyone else?

Device A: iPad 3rd Gen (iOS6)
Device B: iPhone 4 (iOS 5.1)
Device C: iPhone 4 (iOS 6)

On Device A and C, nothing happens but the following is logged

<warning>: authenticateWithCompletionHandler: enter<br> <warning>: authenticateWithCompletionHandler: exit

On Device B, Gamecenter works as intended.
[import]uid: 181020 topic_id: 31438 reply_id: 331438[/import]

sps wrote:
I have tested with Gamecenter.Init()

I don’t use Gamecenter.Init(), I use this:

[lua]gameNetwork.init( “gamecenter”, initCallback )[/lua]

I have an iPod 4 w/ iOS 6 and it works.

Hope this helps,
Nail [import]uid: 106779 topic_id: 31438 reply_id: 125644[/import]

I meant to say gameNetwork.init( "gamecenter", GC\_Callback )

The Gamecenter document states the following:

[text]
authenticateWithCompletionHandler: Authenticates the local player on the device. (Deprecated in iOS 6.0. Set the authenticateHandler property instead.)
[/text]

Maybe that has something to do with it.
[import]uid: 181020 topic_id: 31438 reply_id: 125650[/import]

That makes sense.

I had to update to Xcode 4.5 and the latest daily build to get Game Center to work as I recall.

When I updated my iPod to iOS 6, my app would not launch on device, although it would load to the device. My next move was to to do both updates. I’m really not sure what the problem was, but I’m thinking it was GC related.

Since you are a test user, you probably can’t get access to the latest builds that seems to work with iOS 6 and Xcode 4.5.

I’m guessing you won’t be able to get GC working until the public build gets patched, but not sure as I’m out of my league here.

Hopefully someone from Corona will jump in and clarify.

Nail [import]uid: 106779 topic_id: 31438 reply_id: 125656[/import]

To build properly for iOS6 you need Xcode 4.5 and build 922 as mentioned in Tom’s blog on Wednesday - it would not surprise me if this was the cause of the issue, there were several changes when iOS6 came out. [import]uid: 52491 topic_id: 31438 reply_id: 125665[/import]

I actually have a subscription to Corona Enterprise and have built the project referenced in the first post with it. My Xcode version was 4.5 and the Enterprise build was 922. The game installed and played perfectly except for the fact that Gamecenter didn’t launch.

On a separate occasion, I built an app using the regular 922 daily build with the following code:

[lua]io.output():setvbuf( “no” );
display.setStatusBar( display.HiddenStatusBar )

local gameNetwork = require(“gameNetwork”)

local function GC_Callback( event )
print(“GC_Callback response”)
for i,v in pairs(event) do
if(type(v) == “table”) then
for j,k in pairs(v) do
print(i,j,k);
end
else
print(i,v)
end
end

if event.data then
gameNetwork.show(“achievements”);
else
end
end

function InitGC()
gameNetwork.init( “gamecenter”, GC_Callback )
end

local function main()
local button = display.newRect(0,0,300,300)
button:addEventListener(“tap”, InitGC)
end

main();[/lua]

This new project used the same provisioning profile and bundle ID as my main project. I tested it with four different devices

Device A: iPhone 4 (iOS 6)
Device B: iPhone 4 (iOS 5.1)
Device C: iPad 3 (iOS 6)
Device D: iPad 2 (iOS 5.0.1)

Device A and D launched Gamecenter correctly.
Device B showed the same logs as the first post.
Device C failed to launch Gamecenter.
[import]uid: 181020 topic_id: 31438 reply_id: 125772[/import]

sps wrote:
I have tested with Gamecenter.Init()

I don’t use Gamecenter.Init(), I use this:

[lua]gameNetwork.init( “gamecenter”, initCallback )[/lua]

I have an iPod 4 w/ iOS 6 and it works.

Hope this helps,
Nail [import]uid: 106779 topic_id: 31438 reply_id: 125644[/import]

I meant to say gameNetwork.init( "gamecenter", GC\_Callback )

The Gamecenter document states the following:

[text]
authenticateWithCompletionHandler: Authenticates the local player on the device. (Deprecated in iOS 6.0. Set the authenticateHandler property instead.)
[/text]

Maybe that has something to do with it.
[import]uid: 181020 topic_id: 31438 reply_id: 125650[/import]

That makes sense.

I had to update to Xcode 4.5 and the latest daily build to get Game Center to work as I recall.

When I updated my iPod to iOS 6, my app would not launch on device, although it would load to the device. My next move was to to do both updates. I’m really not sure what the problem was, but I’m thinking it was GC related.

Since you are a test user, you probably can’t get access to the latest builds that seems to work with iOS 6 and Xcode 4.5.

I’m guessing you won’t be able to get GC working until the public build gets patched, but not sure as I’m out of my league here.

Hopefully someone from Corona will jump in and clarify.

Nail [import]uid: 106779 topic_id: 31438 reply_id: 125656[/import]

To build properly for iOS6 you need Xcode 4.5 and build 922 as mentioned in Tom’s blog on Wednesday - it would not surprise me if this was the cause of the issue, there were several changes when iOS6 came out. [import]uid: 52491 topic_id: 31438 reply_id: 125665[/import]

I actually have a subscription to Corona Enterprise and have built the project referenced in the first post with it. My Xcode version was 4.5 and the Enterprise build was 922. The game installed and played perfectly except for the fact that Gamecenter didn’t launch.

On a separate occasion, I built an app using the regular 922 daily build with the following code:

[lua]io.output():setvbuf( “no” );
display.setStatusBar( display.HiddenStatusBar )

local gameNetwork = require(“gameNetwork”)

local function GC_Callback( event )
print(“GC_Callback response”)
for i,v in pairs(event) do
if(type(v) == “table”) then
for j,k in pairs(v) do
print(i,j,k);
end
else
print(i,v)
end
end

if event.data then
gameNetwork.show(“achievements”);
else
end
end

function InitGC()
gameNetwork.init( “gamecenter”, GC_Callback )
end

local function main()
local button = display.newRect(0,0,300,300)
button:addEventListener(“tap”, InitGC)
end

main();[/lua]

This new project used the same provisioning profile and bundle ID as my main project. I tested it with four different devices

Device A: iPhone 4 (iOS 6)
Device B: iPhone 4 (iOS 5.1)
Device C: iPad 3 (iOS 6)
Device D: iPad 2 (iOS 5.0.1)

Device A and D launched Gamecenter correctly.
Device B showed the same logs as the first post.
Device C failed to launch Gamecenter.
[import]uid: 181020 topic_id: 31438 reply_id: 125772[/import]

Thanks for the detailed info - I will pass this on and see if someone who works with GC can check it out. (I have somewhat limited in that area.) Will see what we can find out :slight_smile: [import]uid: 52491 topic_id: 31438 reply_id: 126129[/import]

A different member of my team actually figured out what the issue was.

If a person chooses not to login after Gamecenter pops up three times, there will be an alert letting the player choose to sign in or to never display the prompt again. If the player chooses to not show the prompt, gameNetwork.init(“gamecenter”, callback) will return error code 2. The error code will persist after the application has been closed.

After that session, Gamecenter will never pop up until the user logs into Gamecenter outside of the app.

My issue was that I somehow reached error code 2 on the devices that did not respond to Gamecenter login. Now I do a check against it and show an alert to the user to login to Gamecenter outside of the app to enable Gamecenter back into the app.

[import]uid: 181020 topic_id: 31438 reply_id: 126157[/import]

Ah - very happy to hear it got sorted and greatly appreciate the very detailed update, will likely help others in the future :slight_smile: Thank you! [import]uid: 52491 topic_id: 31438 reply_id: 126201[/import]

Thanks for the detailed info - I will pass this on and see if someone who works with GC can check it out. (I have somewhat limited in that area.) Will see what we can find out :slight_smile: [import]uid: 52491 topic_id: 31438 reply_id: 126129[/import]

A different member of my team actually figured out what the issue was.

If a person chooses not to login after Gamecenter pops up three times, there will be an alert letting the player choose to sign in or to never display the prompt again. If the player chooses to not show the prompt, gameNetwork.init(“gamecenter”, callback) will return error code 2. The error code will persist after the application has been closed.

After that session, Gamecenter will never pop up until the user logs into Gamecenter outside of the app.

My issue was that I somehow reached error code 2 on the devices that did not respond to Gamecenter login. Now I do a check against it and show an alert to the user to login to Gamecenter outside of the app to enable Gamecenter back into the app.

[import]uid: 181020 topic_id: 31438 reply_id: 126157[/import]

Ah - very happy to hear it got sorted and greatly appreciate the very detailed update, will likely help others in the future :slight_smile: Thank you! [import]uid: 52491 topic_id: 31438 reply_id: 126201[/import]