Получив ошибку, выложите на Facebook IOS

Я использую последнюю версию Facebook SDK 4.1 для IOS, но когда я публикую изображение и текст, выдает ошибку. Ниже мой код -

NSArray * permissions = [[NSArray alloc] initWithObjects: @ "publish_actions", @ "user_photos", nil];

        [FBSession openActiveSessionWithPublishPermissions:permissions defaultAudience:FBSessionDefaultAudienceFriends allowLoginUI:YES completionHandler:^(FBSession *session,FBSessionState status,NSError *error)
         {
             if (error)
             {

             }
             else if(FB_ISSESSIONOPENWITHSTATE(status))
             {
                 [[FBRequest requestForMe] startWithCompletionHandler:
                  ^(FBRequestConnection *connection, NSDictionary<FBGraphUser> *user, NSError *error) {
                      if (!error)
                      {
                          NSDictionary *parameters = [NSDictionary dictionaryWithObjectsAndKeys:
                                                      imgShare,@"picture", txtViewPost.text,@"message",
                                                      nil];

                          FBRequest *request = [FBRequest requestWithGraphPath:@"me/feed"
                                                                    parameters:parameters
                                                                    HTTPMethod:@"POST"];

                          FBRequestConnection *connection = [[FBRequestConnection alloc] init];

                          [connection addRequest:request
                               completionHandler:^(FBRequestConnection *connection, id result, NSError *error)
                           {
                               if (!error)
                               {
                                   isFacebookActive = YES;
                                   [btnFacebook setImage:[UIImage imageNamed:@"facebook-round-active-btn.png"] forState:UIControlStateNormal];
                                   NSLog(@"Photo uploaded successfuly! %@",result);

                               }
                               else
                               {
                                   NSLog(@"Photo uploaded failed :( %@",error.userInfo);
                                   isFacebookActive = NO;
                                   [btnFacebook setImage:[UIImage imageNamed:@"facebook-round--btn.png"] forState:UIControlStateNormal];
                               }
                           }];
                          [connection start];

                      }
                  }];

             }
         }];

Ниже приведен журнал ошибок

Photo uploaded failed :( {
    "com.facebook.sdk:ErrorSessionKey" = "<FBSession: 0x7fb7d20a3280, state: FBSessionStateOpen, loginHandler: 0x7fb7d0f40520, appID: 386374258207146, urlSchemeSuffix: , tokenCachingStrategy:<FBSessionTokenCachingStrategy: 0x7fb7d0ea89b0>, expirationDate: 2015-07-12 08:31:47 +0000, refreshDate: 2015-05-13 14:30:50 +0000, attemptedRefreshDate: 0000-12-30 00:00:00 +0000, permissions:(\n    \"user_location\",\n    \"user_events\",\n    \"user_photos\",\n    \"user_videos\",\n    \"user_friends\",\n    email,\n    \"publish_actions\",\n    \"public_profile\"\n)>";
    "com.facebook.sdk:HTTPStatusCode" = 400;
    "com.facebook.sdk:ParsedJSONResponseKey" =     {
        body =         {
            error =             {
                code = 100;
                message = "(#100) picture is not properly formatted";
                type = OAuthException;
            };
        };
        code = 400;
    };
}

1 ответ

После изменения кода "я / канал" на "я / фотографии", это работает для меня.

FBRequest * request = [FBRequest requestWithGraphPath: @ "me / photos" параметры: параметры HTTPMethod:@"POST"];

Другие вопросы по тегам