2

我是 facebook SDK 的新手。上次我使用 facebook IOS SDK 3.0 并通过图形 API 发布图像。它正在工作,但现在没有。我升级到 3.1,但它总是返回 HTTP ERROR 200。有人可以帮助我吗?

这是代码

- (void) facebookPostPhoto:(UIImage *)photo withMessage:(NSString *)msg withOkAction:(SEL)okAction andNGAction:(SEL)ngAction withTarget:(id)target {
ok = okAction;
ng = ngAction;
curView = target;
NSMutableDictionary *params;
params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
          UIImageJPEGRepresentation(photo, 90), @"source",
          msg, @"message",             
          nil];

if ([FBSession.activeSession.permissions indexOfObject:FacebookPermission_3] == NSNotFound) {
    NSLog(@"permission not found");
    // No permissions found in session, ask for it
    [FBSession.activeSession reauthorizeWithPublishPermissions:[NSArray arrayWithObjects:FacebookPermission_1, FacebookPermission_3, nil] defaultAudience:FBSessionDefaultAudienceFriends completionHandler:^(FBSession *session, NSError *error)
     {
         // If permissions granted, publish the story
         if (!error) [self initPostFacebookWithParams:params];
     }];
} else {
    [self initPostFacebookWithParams:params];
} } 

- (void)initPostFacebookWithParams:(NSMutableDictionary *)params {

[FBRequestConnection startWithGraphPath:@"me/photos" parameters:params HTTPMethod:@"POST" completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
    NSLog(@"ERROR : %@", error.localizedDescription);
    if (!error) {
        NSLog(@"Facebook Post Success..");
        if (ok && curView) {
            [curView performSelector:ok];
        }


    } else {
        NSLog(@"Facebook Post Failed..");
        if (ng && curView) {
            [curView performSelector:ng withObject:error];
        }

    }

}]; }

感谢您的快速响应和帮助!谢谢你!!

4

1 回答 1

0

I think it's either facebook upload's server is down or there is a new policy about image size. When I down sized the image to 320x320 it returns no error, sometimes error too by the way.

So for those who see this question, try to resize your image to smaller size.

于 2012-12-27T11:14:43.313 回答