我需要从Facebook获取place_id以获取facebook checkin部分。因为我正在使用以下代码。请求使用访问令牌的地点ID时,我会收到消息作为格式错误的访问令牌,有时会过期。
NSString *fbToken = [FBSession activeSession].accessTokenData.accessToken;
NSString *fbURL = [NSString stringWithFormat:@"https://graph.facebook.com/search?q=ritual&type=place¢er=9.952786,76.339828&distance=1000&access_token=%@",fbToken];
NSURL *URL = [NSURL URLWithString:[NSString stringWithFormat:@"%@%@",fbURL, fbToken]];
NSLog(@"URL:%@",URL);
NSURLRequest *placeRequest = [NSURLRequest requestWithURL:URL];
//Send the request
[NSURLConnection sendAsynchronousRequest:placeRequest queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse *response, NSData *data, NSError *connectionError)
{
if (!connectionError) {
NSDictionary *Data = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingAllowFragments error:nil];
NSLog(@"data = %@"Data);
}
}];