Facebook Login Timeout on iOS 7 and Daily Build 2013.1215

I recently updated my iPhone 5 to iOS 7 and started testing our game against it using the new Daily Build (1215). I’ve noticed that on the device the facebook.login() method will timeout about 50% of the time it is called. I can see in the Xcode console that CoreAnimation is reporting a timeout, I’ve pasted that bit below.

Sep 25 14:17:11 Brandons-iPhone BloxBlast[288] <Warning>: logging user into Facebook

Sep 25 14:17:21 Brandons-iPhone backboardd[28] <Warning>: CoreAnimation: timed out fence 2dea7

Sep 25 14:17:21 Brandons-iPhone lsd[76] <Warning>: LaunchServices: application launch failed - received error code 11

Sep 25 14:17:32 Brandons-iPhone lsd[76] <Warning>: LaunchServices: application launch failed - received error code 11

Sep 25 14:17:32 Brandons-iPhone BloxBlast[288] <Warning>: CoreAnimation: failed to receive fence reply: 10004003

( The CoreAnimation timeout appears after about 30 seconds of sitting at the default image for the game)

After this part of the log the app is suspended and either Safari or the Facebook App take over ( depending on if the Facebook App is installed ) and the user is asked to authorize the app again and is than taken back to my game. When they return the in-app facebook popup is present asking them to log in again and if they fill out that form it is replaced by a blank in-app popup. 

When the login works correctly the user never sees the Facebook dialog because they have already authorized the access and the app can just log them in and be done with it.

Is anyone else seeing a problem like this when running on the device? In my game I’m only seeing the problem when the app launches from a cold boot, but that is probably specific to my implementation. 

Is there a way to trap a timeout on Facebook login and attempt to try it again later?

Thanks for your help.

  • Brandon

I haven’t seen anything like this.  It may have to do with your implementation.

When are you calling facebook.login()?  Are you calling it in your app’s first block of code (i.e., in the body of main.lua)?  (I think you might be, since you mentioned something to do with your default image, which stays until at least the first code block is finished executing.)  Is your app doing any other heavy lifting (loading big textures, loading long music) during that code block?

Also, I want to make sure I’m understanding the sequence of events correctly.  Let’s say the user hasn’t authorized your app yet.  Your app launches from a cold start and the default image is displayed.  You then call facebook.login() and see your print message in your log.  Ten seconds go by, and a CoreAnimation timeout error shows up.  What happened during those 10 seconds?  Did the default image simply stay on screen?  Or did your app flip over to Facebook/Safari to ask the user’s authorization, then return?

Roughly, your app has to finish launching within a certain amount of time, or iOS will think it’s crashed.  Your best bet is to do only the loading that’s absolutely necessary in your first code block, then show a scene that lets you do additional loading (such as facebook login).

Last, a general question – are you experiencing laggy network connectivity in general (e.g., you have a bad cell signal), or is it only specific to this case?

  • Andrew

I think you’re right it was something specific to my implementation that just happened to appear when I made the switch ti iOS 7. The actual problem seems to be in my loading scene implementation. I was using a timer to delay the transition out of the loading Scene and the delay was too short. I simply extended the delay and now it seems to load correctly. 

Thanks for the reply, your input helped me to think through the problem and track it down.

Great, glad to hear you got it sorted.

  • Andrew

I haven’t seen anything like this.  It may have to do with your implementation.

When are you calling facebook.login()?  Are you calling it in your app’s first block of code (i.e., in the body of main.lua)?  (I think you might be, since you mentioned something to do with your default image, which stays until at least the first code block is finished executing.)  Is your app doing any other heavy lifting (loading big textures, loading long music) during that code block?

Also, I want to make sure I’m understanding the sequence of events correctly.  Let’s say the user hasn’t authorized your app yet.  Your app launches from a cold start and the default image is displayed.  You then call facebook.login() and see your print message in your log.  Ten seconds go by, and a CoreAnimation timeout error shows up.  What happened during those 10 seconds?  Did the default image simply stay on screen?  Or did your app flip over to Facebook/Safari to ask the user’s authorization, then return?

Roughly, your app has to finish launching within a certain amount of time, or iOS will think it’s crashed.  Your best bet is to do only the loading that’s absolutely necessary in your first code block, then show a scene that lets you do additional loading (such as facebook login).

Last, a general question – are you experiencing laggy network connectivity in general (e.g., you have a bad cell signal), or is it only specific to this case?

  • Andrew

I think you’re right it was something specific to my implementation that just happened to appear when I made the switch ti iOS 7. The actual problem seems to be in my loading scene implementation. I was using a timer to delay the transition out of the loading Scene and the delay was too short. I simply extended the delay and now it seems to load correctly. 

Thanks for the reply, your input helped me to think through the problem and track it down.

Great, glad to hear you got it sorted.

  • Andrew