1

现在我尝试使用批处理方法发送多个方法,所以我使用以下代码尝试使用 FBGraph 在 Facebook 上发送两个图像,

NSString *req01 = @"{ \"method\": \"POST\", \"relative_url\": \"me/photos\", \"body\": \"message=MyMessageOnPhotoone\", \"attached_files\": \"myimagedata\"}";
NSString *req02 = @"{ \"method\": \"POST\", \"relative_url\": \"me/photos\", \"body\": \"message=MyMessageOnPhototwo\", \"attached_files\": \"myimagedata\"}";
NSString *allRequests = [NSString stringWithFormat:@"[ %@, %@ ]", req01, req02];
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObject:allRequests forKey:@"batch"];
[facebook requestWithGraphPath:@"me" andParams:params andHttpMethod:@"POST" andDelegate:self];

批处理方法是,

curl 
–F  'access_token=…' \
-F  'batch=[{"method":"POST", \
          "relative_url":"me/photos", \
          "body":"message=My cat photo" \
          "attached_files":"file1" \
         },
         {"method":"POST", \
          "relative_url":"me/photos", \
          "body":"message=My dog photo" \
          "attached_files":"file2" \
         },
        ]’
     -F  'file1=@cat.gif' \
     -F 'file2=@dog.jpg' \
     https://graph.facebook.com

我收到以下错误,

  (
    {
    my binary image encoded data
    code = 400;
    headers =         (
                    {
            name = "WWW-Authenticate";

           my binary image encoded data
        },
                    {
            name = "HTTP/1.1";
            value = "400 Bad Request";
        },
                    {
            name = "Cache-Control";
            value = "no-store";
        },
                    {
            name = "Content-Type";
            value = "text/javascript; charset=UTF-8";
        }
    );
},
    {

     myimage binary encoded data
    code = 400;
    headers =         (
                    {
            name = "WWW-Authenticate";
            myimageBinary encoded data
        },
                    {
            name = "HTTP/1.1";
            value = "400 Bad Request";
        },
                    {
            name = "Cache-Control";
            value = "no-store";
        },
                    {
            name = "Content-Type";
            value = "text/javascript; charset=UTF-8";
        }
    );
   }
  )

我无法纠正代码中的 URL 请求中的问题。

4

0 回答 0