格式错误的访问令牌facebook ios

时间:2014-08-22 05:02:12

标签: ios facebook facebook-graph-api

我需要从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&center=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);


     }

 }];

0 个答案:

没有答案