Titanium JIRA Archive
Appcelerator Modules (MOD)

[MOD-2251] Facebook: graph api not returning results when fields are specified, possibly due to old version of graph api

GitHub Issuen/a
TypeImprovement
PriorityCritical
StatusClosed
ResolutionNot Our Bug
Resolution Date2016-07-18T10:43:30.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsFacebook
Labelsstudio3
ReporterSean MacLachlan
AssigneeChee Kiat Ng
Created2016-03-29T23:37:38.000+0000
Updated2016-07-18T10:43:30.000+0000

Description

calling function getFBEvents(){
    if(fb.getLoggedIn()){
            fb.permissions = ['user_friends', 'user_events'];
            fb.requestWithGraphPath('me?fields=events', {}, 'GET', function(e) {
                if (e.success) {                 
                    Ti.API.log('arrow.js : getFBEvents - result ' + e.result);
                }
        });
    }
}
The above methods successfully returns results. But changing the graph request to specify the fields like this fails in appcelerator
            fb.requestWithGraphPath('me?fields=events{id,name,description,ticket_uri}', {}, 'GET', function(e) {
This however does work when using the Facebook Graph API Explorer. This requires version 2.4 or 2.5 to work. It appears that an older version of the Graph API is being used and there is no way to specify which version to use.

Comments

  1. Sharif AbuDarda 2016-04-06

    Hello, Can you provide a full reproducible code. I am using the below code section for uploading photos. This code comes with the facebook module example code. Please advise where I should make changes. I am using SDK 5.2.1.GA. with facebook module version 5.1.0.
       if(fb.permissions.indexOf('publish_actions') < 0) {
       			fb.requestNewPublishPermissions(['publish_actions'],fb.AUDIENCE_FRIENDS,function(e){
       				if(e.success) {
       					Ti.API.info('Permissions:'+fb.permissions);
       					fb.requestWithGraphPath('me/photos', data, "POST", showRequestResult);
       				}
       				if(e.error) {
       					Ti.API.info('Publish permission error');
       				}
       				if(e.cancelled) {
       					Ti.API.info('Publish permission cancelled');
       				}
       			});
       		} else {
       			fb.requestWithGraphPath('me/photos', data, "POST", showRequestResult);
       		}
       
    Regards, Sharif.
  2. Sean MacLachlan 2016-04-06

    The code is already in this bug report. The problem is
    fb.requestWithGraphPath('me?fields=events{color:red}{id,name,description,ticket_uri}{color}', {}, 'GET', function(e)
  3. Sean MacLachlan 2016-04-06

    More specifically 'me?fields=events{color:#d04437}{id,name,description,ticket_uri}{color}'
  4. Sharif AbuDarda 2016-04-19

    Hello, Please provide a full reproducible code or a sample project that demonstrate the issue. The code section you provided it's not clear what you are trying to do. Also, please provide full steps to reproduce. Regards, Sharif.
  5. Sean MacLachlan 2016-04-19

    This code reproduces the problem.
       function getFBEvents(){
           if(fb.getLoggedIn()){
                   fb.permissions = ['user_friends', 'user_events'];
                   fb.requestWithGraphPath('me?fields=events{id,name,description,ticket_uri}', {}, 'GET', function(e) {
                       if (e.success) {                 
                           Ti.API.log('arrow.js : getFBEvents - result ' + e.result);
                       }
               });
           }
       }
       
    Actual Result: Error {"success":false,"path":"me?fields=events{id,name,description,ticket_uri}"} This is the result using the Facebook Graph API Explorer with me?fields=events{id,name,description,ticket_uri} Expected Result: { "events": { "data": [ { "id": "569818663179115", "name": "Saint Paddler's Day", "description": "Join us for the annual St. Paddler's Day Float and Potluck on Sunday, March 20th. Meet at 10:30 am at the Montour Bridge (Montour Wildlife Area). Maps and directions available from IRS. We will do the vehicle shuttle and then paddle on the Payette, stopping about halfway down on an island to stretch our legs and of course EAT. In the past we have paddled and then returned to Idaho River Sports to eat. This year, weather permitting, we thought we would try having our Irish feast on the river. BRING your potluck dish with you in your kayak, canoe or SUP and we will celebrate St. Paddler's day on the river. Rentals of Kayaks, Canoes and Stand up Paddleboards available for 1/2 price. Call 208-336-4844 for more information." }, ], "paging": { "cursors": { "before": "TlRZANU9ERTROall6TVRjNU1URTFPakUwTlRnME9URTBNREE2TVRrNU9EVTRNREV6TXprNE5EQTQZD", "after": "TVRBeE5USTNNVGcwT1RreU5qWTBNekk2TVRJM01ESTNNVEUwTXpveE9UazROVGd3TVRNek9UZAzBNRGc9" } } }, "id": "10153942434722150" }
  6. Sharif AbuDarda 2016-04-26

    Hello, Please provide a full reproducible code or a sample project that demonstrate the issue. A partial section of code will not do. The code section you provided it's not clear what you are trying to do. Also, please provide full steps to reproduce. Regards, Sharif.
  7. Sean MacLachlan 2016-04-26

    Sharif, The code included is the simplest code possible to reproduce the problem. fb.requestWithGraphPath('me?fields=events{id,name,description,ticket_uri}',... This does not return a result. I just want the result of this call. This does return a result fb.requestWithGraphPath('me?fields=events',... By adding{color:#d04437} {id,name,description,ticket_uri}{color} to the Graph Path no result is returned This is an appcelerator bug because when I add that command in the developers.facebook.com > Graph Path Explorer that command is valid and does return a result
  8. Chee Kiat Ng 2016-04-29

    As [~sean.maclachlan] has mentioned, it's most likely our Facebook module is supporting an older version that is not 2.4. or 2.5. Filing ticket as improvement to update our module.
  9. Hans Knöchel 2016-07-18

    We are using the latest Facebook SDK on both iOS and Android. As we just call the native method (that uses the latest graph), this is how it is done: http://stackoverflow.com/questions/32437731/facebook-sdk-2-4-how-to-get-events-from-user So specifying "me/events" and {fields: "id,name,description,ticket_uri"} for the 2nd param could work out. Closing for now, since it is no issue on our side but on the format specified.

JSON Source