New problems with Game Center

Hi,
Version 2012.928 (2012.10.4)

Two new issues with game center on IOS 6: shows up on Xcode simulator and device (iPhone4)

  1. Lauch app, press home button during game center activity; relaunch app. App crashes. Launch app for second time, no issue. I’m using all the recommended fixes for the game center orientation Apple bug. Has anyone else experienced this ? I have UIApplicationExitsOnSuspend = true

  2. To get around the annoying game center log-in box the first time you launch an app, I am only calling gameNetwork.init() when the user pressed the game center icon.
    I then call gameNetwork.show() from within the initCallback() function
    The issue is that if there is no internet connection, initCallback() is not called at all. So the user will press the game center icon and get nothing. What is needed is a callback to indicate that login failed.

CoronaLabs, any advice or ideas? Hopefully these can be incorporated into the use-cases you are looking at now.

Anthony [import]uid: 87194 topic_id: 31738 reply_id: 331738[/import]

Anthony wrote:
The issue is that if there is no internet connection, initCallback() is not called at all. So the user will press the game center icon and get nothing. What is needed is a callback to indicate that login failed.

Newb here, you’re mileage may vary.

I’ve got my own GC issues, but my work around for this one is to check for network availability and if there is no network, when the GC button is tapped, fire off an alert that tells the user “Game Center not available, no internet connection”.

I like your suggestion, this may help though.

Here’s what I use and it should give you a jump start, it works for me anyways.

-- function to listen for system events  
local function onSystemEvent( event )  
  
 if event.type == "applicationStart" then  
 print("ApplicationStart from onSystemEvent has been called")  
 NetworkAvailable = false  
 loggedIntoGC = false  
  
 if network.canDetectNetworkStatusChanges then  
 network.setStatusListener( "www.google.com", myNetworkReachabilityListener )  
 print("network.setStatusListener has been called aimed at Google")  
 else  
 network.setStatusListener( "www.google.com", nil )  
 native.showAlert( "No Internet Connection!", "User is not logged into Game Center", { "OK" } )   
 print("network reachability not supported on this platform")  
 NetworkAvailable = false  
 loggedIntoGC = false  
 end  
 elseif event.type == "applicationSuspend" then  
 --DeviceSuspend = true  
 NetworkAvailable = false  
 loggedIntoGC = false  
 print("deviceSuspendMonitor() is called/ DeviceSuspend = true")  
 elseif event.type == "applicationResume" then  
 NetworkAvailable = false  
 loggedIntoGC = false  
 if network.canDetectNetworkStatusChanges then  
 network.setStatusListener( "www.google.com", myNetworkReachabilityListener )  
 print("network.setStatusListener has been called aimed at Google")  
 else  
 network.setStatusListener( "www.google.com", nil )  
 native.showAlert( "No Internet Connection!", "User is not logged into Game Center", { "OK" } )   
 print("network reachability not supported on this platform")  
 NetworkAvailable = false  
 loggedIntoGC = false  
 end   
  
 end  
 return true  
else return  
end  
Runtime:addEventListener( "system", onSystemEvent )  
  

Hope this helps.

Nail [import]uid: 106779 topic_id: 31738 reply_id: 126764[/import]

Hi Nail,

Thanks for your help! Yes, I agree that checking network available is the way to go and should solve the second issue.

CoronaLabs, any comment on the first crashing issue? Anyone else out there “discovered” this?

Anthony [import]uid: 87194 topic_id: 31738 reply_id: 126803[/import]

Anthony wrote:
The issue is that if there is no internet connection, initCallback() is not called at all. So the user will press the game center icon and get nothing. What is needed is a callback to indicate that login failed.

Newb here, you’re mileage may vary.

I’ve got my own GC issues, but my work around for this one is to check for network availability and if there is no network, when the GC button is tapped, fire off an alert that tells the user “Game Center not available, no internet connection”.

I like your suggestion, this may help though.

Here’s what I use and it should give you a jump start, it works for me anyways.

-- function to listen for system events  
local function onSystemEvent( event )  
  
 if event.type == "applicationStart" then  
 print("ApplicationStart from onSystemEvent has been called")  
 NetworkAvailable = false  
 loggedIntoGC = false  
  
 if network.canDetectNetworkStatusChanges then  
 network.setStatusListener( "www.google.com", myNetworkReachabilityListener )  
 print("network.setStatusListener has been called aimed at Google")  
 else  
 network.setStatusListener( "www.google.com", nil )  
 native.showAlert( "No Internet Connection!", "User is not logged into Game Center", { "OK" } )   
 print("network reachability not supported on this platform")  
 NetworkAvailable = false  
 loggedIntoGC = false  
 end  
 elseif event.type == "applicationSuspend" then  
 --DeviceSuspend = true  
 NetworkAvailable = false  
 loggedIntoGC = false  
 print("deviceSuspendMonitor() is called/ DeviceSuspend = true")  
 elseif event.type == "applicationResume" then  
 NetworkAvailable = false  
 loggedIntoGC = false  
 if network.canDetectNetworkStatusChanges then  
 network.setStatusListener( "www.google.com", myNetworkReachabilityListener )  
 print("network.setStatusListener has been called aimed at Google")  
 else  
 network.setStatusListener( "www.google.com", nil )  
 native.showAlert( "No Internet Connection!", "User is not logged into Game Center", { "OK" } )   
 print("network reachability not supported on this platform")  
 NetworkAvailable = false  
 loggedIntoGC = false  
 end   
  
 end  
 return true  
else return  
end  
Runtime:addEventListener( "system", onSystemEvent )  
  

Hope this helps.

Nail [import]uid: 106779 topic_id: 31738 reply_id: 126764[/import]

Hi Nail,

Thanks for your help! Yes, I agree that checking network available is the way to go and should solve the second issue.

CoronaLabs, any comment on the first crashing issue? Anyone else out there “discovered” this?

Anthony [import]uid: 87194 topic_id: 31738 reply_id: 126803[/import]