简体   繁体   中英

About facebook checkin in facebook graph api in iphone

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];

}

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM