Forum Sitebox Facebook Games Broken Suddenly

Discussion and help relating to the PlayerIO webpage and Facebook app hosting solution, Sitebox.

Facebook Games Broken Suddenly

Postby azuanagames » May 16th, 2013, 5:11 am

My facebook versions of my games have suddenly stopped working... I can't figure out what is wrong. Any ideas?

They seem to get stuck trying to load the facebook api...

Thank You

P.S. The games are:

https://apps.facebook.com/azuana-bingo

and

https://apps.facebook.com/azuana-dominoes
azuanagames
 
Posts: 157
Joined: April 29th, 2010, 10:59 pm

Re: Facebook Games Broken Suddenly

Postby azuanagames » May 16th, 2013, 6:21 am

I've narrowed it down to here:

Code: Select all
FB.Data.query('SELECT first_name, pic_square, locale FROM user WHERE uid = me()').wait(function(rows:*):void
{
   if (rows.length == 1) {
   Globals.instance().myName = rows[0].first_name;
   Globals.instance().myPhoto = rows[0].pic_square;
   Globals.instance().language = ((rows[0].locale || "") as String).substr(0, 2);
   connectToPlayerIO();
    } else {
   handleLoginError(new PlayerIOError(Globals.instance().translate('error.facebook.loading', "Could not query Facebook for user information."), 999));
     }
}, function(e:*):void {
  handleLoginError(new PlayerIOError(Globals.instance().translate('error.facebook.loading', e), 999));
});


I'm never getting to the connectToPlayerIO() call and I'm not seeing any errors either. The query call just hangs... Did facebook break this? I imagine I would see other folks upset?

Heeeeelp
azuanagames
 
Posts: 157
Joined: April 29th, 2010, 10:59 pm

Re: Facebook Games Broken Suddenly

Postby Henrik » May 16th, 2013, 7:28 am

FB.Data.query was supposed to stop working in January already:
https://developers.facebook.com/blog/post/561/
Henrik
.IO
 
Posts: 1880
Joined: January 4th, 2010, 1:53 pm

Re: Facebook Games Broken Suddenly

Postby lutc » May 16th, 2013, 9:21 am

Yes it got me too.

To fix the issues, I'm now using FB.api with fql however I still can't get it to work.

However both

Code: Select all
FB.api('/fql', {q:'select name from user where uid=' + facebookUserId}, function(response:*) : void {
   trace("response.name");
})

and

Code: Select all
FB.api('/fql?q=select name from user where uid=' + facebookUserId, function(response:*) : void {
   trace("response.name");
})


are not working.

Strangely enough,

even
Code: Select all
FB.api('/me', function(response:*) : void {
   trace(FB.toString(response));
})

gives

Code: Select all
FB: Graph call: path=/me, method=GET, params={}
Error: Syntax Error
   at MethodInfo-1941()
   at MethodInfo-1948()
   at MethodInfo-1949()
   at JSON$/deserialize()
   at MethodInfo-1579()
   at flash.events::EventDispatcher/dispatchEventFunction()
   at flash.events::EventDispatcher/dispatchEvent()
   at flash.net::URLLoader/onComplete()


Any help please? I am using the PlayerIO Facebook Graph AS3 API
lutc
 
Posts: 64
Joined: February 13th, 2013, 3:05 pm

Re: Facebook Games Broken Suddenly

Postby azuanagames » May 16th, 2013, 1:00 pm

Well... that is not good. I have to recreate a bunch of code apparently... Not player.io's fault at all... :(
azuanagames
 
Posts: 157
Joined: April 29th, 2010, 10:59 pm

Re: Facebook Games Broken Suddenly

Postby azuanagames » May 17th, 2013, 2:21 am

Can't even debug this... I get the following

Error
An error occured, please try again.

When using quick connect with:

Code: Select all
PlayerIO.quickConnect.facebookOAuthConnectPopup(
                        stage,
                        _playerio_game_id,
                        "_blank",
                        [],,
                        cbLoginFacebook,
                        handleLoginError);


Will you be updating the seedlings demo? I wish we had better documentation for the Facebook api in Player.IO.

This worked like a charm:
Code: Select all
FB.api('/fql', {q:'SELECT first_name, pic_square, locale FROM user WHERE uid=me()'}, function(result:*):void {
});


Of note is that this returns a json object that has data as the array of results, the result is not rows... So:
Code: Select all
result.data[0].first_name is correct
Last edited by azuanagames on May 17th, 2013, 3:53 am, edited 1 time in total.
azuanagames
 
Posts: 157
Joined: April 29th, 2010, 10:59 pm

Re: Facebook Games Broken Suddenly

Postby lutc » May 17th, 2013, 3:46 am

Hi azuanagames,

You are encountering the same issues that I encountered.

Missing "&" before "callback=c" and also errors in JSON deserialization after I managed to get it to send me the data.

In the end, I wrote this function as a workaround. Maybe it will help you.

Code: Select all
function facebookAPI(str:String, access_token:String, successCallback:Function, failCallback:Function) {
   var request:URLRequest = new URLRequest("https://graph.facebook.com/" + str + "&access_token=" + access_token);   
   var loader:URLLoader = new URLLoader();   
   request.method = URLRequestMethod.GET;   
   loader.addEventListener(Event.COMPLETE,
      function (event:Event) {
         var loader:URLLoader = URLLoader(event.target);
         var object:Object = JSON.deserialize(loader.data);
         successCallback(object);
      }, false, 0, true);   
   loader.addEventListener(IOErrorEvent.IO_ERROR, failCallback, false, 0, true);   
   loader.load(request); 
}
lutc
 
Posts: 64
Joined: February 13th, 2013, 3:05 pm

Re: Facebook Games Broken Suddenly

Postby azuanagames » May 17th, 2013, 5:57 pm

Actually this works fine now:

Code: Select all
FB.api('/fql', {q:'SELECT first_name, pic_square, locale FROM user WHERE uid=me()'}, function(result:*):void {
});


I'm using the latest Facebook api from the seedlings demo.
azuanagames
 
Posts: 157
Joined: April 29th, 2010, 10:59 pm

Re: Facebook Games Broken Suddenly

Postby lutc » May 18th, 2013, 3:02 am

Ah ok. Is https://github.com/playerio/Facebook-Graph-As3 an older version of the API?
lutc
 
Posts: 64
Joined: February 13th, 2013, 3:05 pm

Re: Facebook Games Broken Suddenly

Postby azuanagames » May 18th, 2013, 4:27 am

Shouldn't be... But it definitely is working for me now.
azuanagames
 
Posts: 157
Joined: April 29th, 2010, 10:59 pm


Return to Sitebox