2013-04-02 35 views
0
- (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"];      
     } 
    }]; 
} 

我有這樣的錯誤:Facebook的FQL查詢(#601)分析器錯誤:意外「_52096」在位置133

>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

打印您的fql查詢 - 它會幫助您找到錯誤的來源 – user15

回答

0

,我發現我的問題和解決問題的方法是從所有者字符串我綁定。 相冊是fql中的一個字符串標識符,當我將它綁定到facebook時,響應albumId是一個NSDecimalNumber,解析問題只需添加commons以獲取幫助,就是這樣。 現在需要查看查詢。

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];