FBSDKGraphRequest不再发布图像和文本(不再有文字)

时间:2016-03-14 00:46:19

标签: xcode facebook-sdk-4.x

我发布到组用户墙,(图像和文本)。它已经工作了很长时间,最近停止工作(现在,图像已发布,但没有文字:()。任何想法是否有新方式或规则?(没有报告错误)

    [params setObject:sContent forKey:@"message"];
    [params setObject:yourImageData forKey:@"picture"];



    [[[FBSDKGraphRequest alloc]
      initWithGraphPath:@"xxxxxxxxxxxxxxx/photos"
      parameters: params
      HTTPMethod:@"POST"]
     startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
         if (!error) {

1 个答案:

答案 0 :(得分:2)

以下是我的工作代码(In Swift):

let params = ["message": "Test message", "sourceImage" : UIImagePNGRepresentation(UIImage(named: "test.jpg")!)!]
FBSDKGraphRequest(graphPath: "me/photos", parameters: params, HTTPMethod: "POST").startWithCompletionHandler({ (connection, result, error) -> Void in
    guard let response = result else {
        print("No response received")
        if let errorInfo = error {
            print("errorInfo: \(errorInfo)")
        }
        return }

    print(response)
})

检查'发布' link部分了解更多内容。

如果您将其转换为Objective-C有任何困难,请告诉我。