有人知道使用 Facebook iOS SDK 进行 Facebook 签到吗?
我已经使用 Facebook Graph API 创建了一个应用程序,现在我想添加签入功能。我该怎么做?
我尝试了以下代码,但它返回nil
.
FbGraphResponse *fb_graph_response = [fbGraph doGraphGet:@"me/checkins" withGetVars:nil];
//我的doTheGraph
方法
- (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];
}