Facebook FQL查询(#601)解析器错误:位置133处的意外“_52096”

时间:2013-04-02 08:55:58

标签: iphone ios objective-c facebook-fql

- (void)getPhotosForAlbumId:(NSString *)albumId andUserIdentifier:(NSString *)userId
{
  NSString *ob = userId != nil?userId:@"me()";

    NSString *query = [NSString stringWithFormat:
                       @"SELECT pid,src,src_big,src_big_width,src_big_height, src_small_width, src_small_height,created FROM photo WHERE aid = %@ and owner = %@", albumId, ob];

    // Set up the query parameter
    NSDictionary *queryParam =
        [NSDictionary dictionaryWithObjectsAndKeys:query, @"q", nil];

    // Make the API request that uses FQL    
    [FBRequestConnection startWithGraphPath:@"/fql"
                                 parameters:queryParam
                                 HTTPMethod:@"GET"
                          completionHandler:^(FBRequestConnection *connection,
                                              id result,
                                              NSError *error) {
         if (error)
         {
             NSLog(@"Error: %@", [error localizedDescription]);
         }
         else
         {
             NSLog(@"Result: %@", result);
       NSArray *data = [result objectForKey:@"data"];                       
         }
     }];
}

我有这个错误:

>error:Error Domain=com.facebook.sdk Code=5 "The operation couldn’t be completed. (com.facebook.sdk error 5.)" UserInfo=0xd16a20 {com.facebook.sdk:ErrorSessionKey=<FBSession: 0xdf4f20, state: FBSessionStateOpen, loginHandler: 0xdf52a0, appID: 446665702078325, urlSchemeSuffix: , tokenCachingStrategy:<FBSessionTokenCachingStrategy: 0xf1c34c0>, expirationDate: 2013-05-31 11:29:38 +0000, refreshDate: 2013-04-01 11:29:38 +0000, attemptedRefreshDate: 0001-12-30 00:00:00 +0000, permissions:(
    "friends_photos",
    "user_photos"
)>, com.facebook.sdk:ParsedJSONResponseKey=<CFBasicHash 0xd74560 [0x3f721650]>{type = mutable dict, count = 2,
entries =>
    1 : <CFString 0x6b2968 [0x3f721650]>{contents = "code"} = <CFNumber 0xd74590 [0x3f721650]>{value = +400, type = kCFNumberSInt32Type}
    2 : <CFString 0x6aa5e8 [0x3f721650]>{contents = "body"} = <CFBasicHash 0xd2caa0 [0x3f721650]>{type = mutable dict, count = 1,
entries =>
    11 : <CFString 0xd51570 [0x3f721650]>{contents = "error"} = <CFBasicHash 0xd14880 [0x3f721650]>{type = mutable dict, count = 3,
entries =>
    2 : <CFString 0xd2cad0 [0x3f721650]>{contents = "type"} = <CFString 0xd121c0 [0x3f721650]>{contents = "OAuthException"}
    3 : <CFString 0xd15dc0 [0x3f721650]>{contents = "message"} = <CFString 0xd13120 [0x3f721650]>{contents = "(#601) Parser error: unexpected '_52096' at position 133."}
    6 : <CFString 0xd26720 [0x3f721650]>{contents = "code"} = 601
}}}, com.facebook.sdk:HTTPStatusCode=400}

1 个答案:

答案 0 :(得分:0)

我找到了解决问题的方法,问题来自所有者字符串我绑定的内容。 专辑是fql中的一个字符串标识符,当我从facebook回复它时,它就是一个NSDecimalNumber,为了解决问题,只需添加辅助就可以了。 现在需要查看查询。

NSString *query = [NSString stringWithFormat:
@"SELECT pid,src,src_big,src_big_width,src_big_height, src_small_width, src_small_height,created FROM photo WHERE aid = \"%@\" and owner = %@", albumId, ob];