I'm not sure if it's what you are looking for, but if you are trying to do something simple like getting the public posts of a user, you can do it like this.
Use the following request to get the token:
https://graph.facebook.com/oauth/access_token?client_id=YOUR_APP_ID&client_secret=YOUR_APP_SECRET&grant_type=client_credentials
I'm guessing you've got your app id and secret since you've retrieved the token already. Anyway, the token will be returned in the response like this:
access_token=ACCESS_TOKEN
Parse out the token: and put it in the following request:
https://graph.facebook.com/FACEBOOK_USER_ID/posts?access_token=ACCESS_TOKEN
You can use the following code to parse out the token:
NSRange access_token_range = [responseString rangeOfString:@"access_token="];
if (access_token_range.length > 0) {
int from_index = access_token_range.location + access_token_range.length;
NSString *access_token = [responseString substringFromIndex:from_index];
NSLog(@"access_token: %@", access_token);
}
EDIT: The get posts URL will give BadURL due to illegal chars. You can do like this to fix it:
NSString *encodedURLString = [yourUrlString stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding];
NSURL *url = [NSURL URLWithString:encodedURLString];
I'm not using the Facebook SDK, so I don't really know how it works, but I guess that you should do something like this:
[_facebook requestWithGraphPath:@"[user_id]/feed"
andParams:[NSMutableDictionary dictionaryWithObject:ACCESS_TOKEN forKey:@"access_token"]
andHttpMethod:@"GET"
andDelegate:self];
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…