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

我有这个错误:

>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}
4

1 回答 1

0

I found a solution for my problem and problem was from owner string what i bind. Album is a string identifier in fql and when I bind it from facebook response albumId was a NSDecimalNumber, to resolv problem just add the commons for aid and that is it. How need to look query now.

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];
于 2013-04-04T10:19:48.480 回答