我正在尝试在我的 iOS 应用程序中使用以下 FQL 语句
SELECT comment_info,likes,share_count FROM stream WHERE post_id
出于某种原因,我不断从图形 API 中收到错误消息
解析错误:意外的“?” 在位置 70 OAuth 异常
由于某种原因,该位置移动了一个“?” 被添加到我的 SLRequests 的末尾?这是我正在使用的代码块。现在让我发疯,因为我已经尝试了很多事情,但仍然无法摆脱这个,但在使用相同的方法拉 /me/home 时工作正常。
NSLog(@"ID: %@", graphID);
NSString* urlText = [NSString stringWithFormat: @"https://graph.facebook.com/fql?q=SELECT comment_info,likes,share_count FROM stream WHERE post_id = '%@'", graphID];
urlText = [urlText stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSURL *url = [NSURL URLWithString: urlText];
SLRequest * request = [SLRequest requestForServiceType:SLServiceTypeFacebook requestMethod:SLRequestMethodGET URL:url parameters: nil];
request.account = self.facebookAccount;
[request performRequestWithHandler:^(NSData *responseData, NSHTTPURLResponse *urlResponse, NSError *error) {
NSLog(@"url %@", request.URL.absoluteURL);
NSString * responseString = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];
NSError* responseError;
NSDictionary* jsonDict = [NSJSONSerialization JSONObjectWithData:[responseString dataUsingEncoding:NSUTF8StringEncoding] options:kNilOptions error:&responseError];
NSArray * dataArray = jsonDict[@"data"];
[dataArray enumerateObjectsUsingBlock:^(NSDictionary * infoDictionary, NSUInteger idx, BOOL *stop) {
NSNumber *likesCount;
NSNumber *commentsCount;
likesCount = [NSNumber numberWithInt: [infoDictionary[@"likes"][@"count"] integerValue]];
commentsCount = [NSNumber numberWithInt: [infoDictionary[@"comment_info"][@"comment_count"] integerValue]];
NSLog(@"likes %@", likesCount);
}];
}];