0

Does anyone know about Facebook checkins with the Facebook iOS SDK?

I have made an application using Facebook Graph API and now I want to add the capability to checkin to it. How would I do this?

I have tried the following code but it returns nil.

FbGraphResponse *fb_graph_response = [fbGraph doGraphGet:@"me/checkins" withGetVars:nil];

//my doTheGraph method

    - (FbGraphResponse *)doGraphGet:(NSString *)action withGetVars:(NSDictionary *)get_vars {

NSString *url_string = [NSString stringWithFormat:@"https://graph.facebook.com/%@?", action];

//tack on any get vars we have...
if ( (get_vars != nil) && ([get_vars count] > 0) ) {

    NSEnumerator *enumerator = [get_vars keyEnumerator];
    NSString *key;
    NSString *value;
    while ((key = (NSString *)[enumerator nextObject])) {

        value = (NSString *)[get_vars objectForKey:key];
        url_string = [NSString stringWithFormat:@"%@%@=%@&", url_string, key, value];

    }//end while    
}//end if

if (accessToken != nil) {
    //now that any variables have been appended, let's attach the access token....
    url_string = [NSString stringWithFormat:@"%@access_token=%@", url_string, self.accessToken];
}

//encode the string
url_string = [url_string stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];

return [self doGraphGetWithUrlString:url_string];

}

Jean-Luc Godard
  • 1,873
  • 3
  • 28
  • 53
  • 1
    Are you completely up to date with the FB iOS SDK? This doesn't look familiar to me, and I am currently working with the SDK... – Ryan Wersal Apr 26 '11 at 06:51
  • yup..and I am using.. https://github.com/reallylongaddress/iPhone-Facebook-Graph-API.. for reference – Jean-Luc Godard Apr 26 '11 at 07:12
  • In addition to my answer, I'll try to help resolve this issue for you: is fbGraph nil? If so, fb_graph_response will be nil as well. – Ryan Wersal Apr 26 '11 at 07:30
  • thanks Ryan..and no its not nil..coz when i post me/feed it is showing me my feed.. – Jean-Luc Godard Apr 26 '11 at 07:37
  • 1
    At this point, I think I/we'll need more of your code. My thought I just checked up on was that perhaps the graph extension was "me/checkin" to list checkins (for whatever reason) but I can confirm you have that part correct. Could you perhaps post the innards of the `doGraphGet::` method? – Ryan Wersal Apr 26 '11 at 07:40
  • sorry for being late...updated in the question...:) – Jean-Luc Godard Apr 26 '11 at 08:55
  • 1
    Well I didn't see anything in that, so I downloaded the project off github and all the code looks sound, nothing out of the ordinary. I did a bit of testing with my account through the Graph API and noticed a possible reason for the `nil`. I have not used Facebook Places or checked in with FB, so my Graph API request of `"me/checkins"` yields `{"data":[ ]}` or something very similar. – Ryan Wersal Apr 26 '11 at 16:24
  • 1
    I would recommend putting a breakpoint on that line and stepping **into** the libary's method calls and see where it might be returning nil, or perhaps discovering if my suspicion above is correct. Hopefully that will turn something up. – Ryan Wersal Apr 26 '11 at 16:26
  • @Ryan...hey Ryan I did checkin ..but still data is coming `nil`...i did some search and found this..http://forum.developers.facebook.net/viewtopic.php?pid=337319#p337319...is this possible?? – Jean-Luc Godard Apr 27 '11 at 05:43
  • @Ryan...its done...they were upgrading them self...thanks very very much for your help and effort...thanks – Jean-Luc Godard Apr 27 '11 at 06:00
  • Glad you got it working, good luck with your project! – Ryan Wersal Apr 27 '11 at 14:09

1 Answers1

2

This isn't a great answer, but needs to be noticed. The project linked in your comment to mine under your question is no longer supported or maintained:

NOTE!!: this project is no longer maintained. The official Facebook/iOS SDK can be found here: https://github.com/facebook/facebook-iphone-sdk This project is an open source Objective-C (iPhone/iPad) library for communciating with the Facebook Graph API

That is why I didn't recognize your code, it isn't the Official Facebook iOS SDK.

I strongly encourage you to switch to the up-to-date, and more importantly, maintained project as soon as possible.

Ryan Wersal
  • 3,210
  • 1
  • 20
  • 29
  • @ryan..thanks bro...but I have done the integration using it and it is working fine for me..not maintained though..but it is working fine...:( – Jean-Luc Godard Apr 26 '11 at 07:23
  • 'This project is an open source Objective-C (iPhone/iPad) library for communciating with the Facebook Graph API' and I have used it for this purpose only – Jean-Luc Godard Apr 26 '11 at 07:27
  • 1
    For the record, depending on your level of integration (which I would have a hard time thinking would be all *too* involved) I would have to expect that changing to the official FB iOS SDK wouldn't be that different from the current implementation. The styles are similar, just the classes and their public methods are named/called marginally differently. – Ryan Wersal Apr 26 '11 at 07:31