Getting all my events via Facebook iOS SDK

前端 未结 5 1328
囚心锁ツ
囚心锁ツ 2021-02-19 07:13

In my iOS app, I get an access token using the following code:

    [self.facebook authorize:[NSArray arrayWithObjects:@\"user_events\",
@\"friends_events\",  nil         


        
相关标签:
5条回答
  • 2021-02-19 07:53

    The request

    /me/events

    only gives you the events a user is (maybe) planning to attend. The response doesn't include events which the user has been invited to (but not responded to), or declined.

    There are other requests that may be of help:

    You can check if a user has been invited to an event like so:

    /EVENT_ID/invited/USER_ID

    RSVP status can be checked by event:

    /EVENT_ID/attending

    /EVENT_ID/maybe

    /EVENT_ID/declined

    /EVENT_ID/invited

    where each request returns a list of users with the queried RSVP status.

    0 讨论(0)
  • 2021-02-19 07:53

    Use /me/events for getting the events the user has responded to, and /me/events/not_replied for the others.

    For example (assuming you have created a session):

    [FBRequestConnection startWithGraphPath:@"/me/events/not_replied" completionHandler:^(FBRequestConnection *connection, id result, NSError *error)
    {
        FBGraphObject* data = (FBGraphObject*)result;
        NSMutableArray* array = [data objectForKey:@"data"];
    
        //parse data etc..
    }];
    

    See https://developers.facebook.com/docs/graph-api/reference/v2.0/user/events/ for more info.

    0 讨论(0)
  • 2021-02-19 07:56

    I think you may get events by fql query. You need to try this.

    Also see this How-To: Use the Graph API to Manage Events.

    You will need to HTTP Get the following from the Graph API:

    fql?q=SELECT uid,eid,rsvp_status FROM event_member WHERE uid = me()

    You can get back all statuses from that call.

    {
      "data": [
        {
          "uid": "723020003",
          "eid": "19935786340002",
          "rsvp_status": "not_replied"
        },
        {
          "uid": "723020003",
          "eid": "234524000290351",
          "rsvp_status": "attending"
        },
        {
          "uid": "723020003",
          "eid": "210091000081240",
          "rsvp_status": "declined"
        },
        {
          "uid": "723020003",
          "eid": "210091000341240",
          "rsvp_status": "unsure"
        }
      ]
    }
    
    0 讨论(0)
  • 2021-02-19 08:02

    This isn't a complete solution, and this may not work, but see if it's possible to get access to the iCal feed of a user's Facebook events. I subscribe to my iCal feed, and I noticed that all events, even new ones that I have yet to RSVP to are included in the feed.

    Something to try anyway!

    0 讨论(0)
  • 2021-02-19 08:13

    You can get list of events regardless of their RSVP status with next FQL query:

    SELECT eid, name, venue, location, start_time FROM event WHERE eid IN (
      SELECT eid from event_member WHERE uid = me()
    )
    

    This will not return RSVP status for each event but just events details. You may wish to use Batch Requests to get both details of events and rsvp_status with same query.

    https://graph.facebook.com/?method=post&batch=[
      {
        "name":"rsvp",
        "relative_url":"fql?q=SELECT+eid,rsvp_status+FROM+event_member+WHERE+uid=me()",
        "omit_response_on_success":false
      },
      {
        "relative_url":"?ids={result=rsvp:$.data.*.eid}"
      }
    ]
    

    See event and event_member table documentation for details on other fields you may wish to retrieve.

    Notes:

    Starting July 5th, an access token will be required to access even public events.

    0 讨论(0)
提交回复
热议问题