使用FBSDKGraphRequest获取进度信息

时间:2015-09-03 08:45:03

标签: ios swift facebook-ios-sdk

我通过Facebook SDK将照片成功发布到用户相册中,其代码如下:

    if((FBSDKAccessToken.currentAccessToken()) != nil) {

        var filename = "2015-09-01T21-30-39_fullsize.jpg"
        let documentsDirectory = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true)[0] as! String
        let dataPath = documentsDirectory.stringByAppendingPathComponent(whagooConf.directoryMediaFiles)
        let filePath = dataPath.stringByAppendingPathComponent(filename)
        var theImage = UIImage(contentsOfFile: filePath)

        var params:NSMutableDictionary = [:]

        params["caption"] = "Test for my fist own app upload"
        params["picture"] = theImage

        FBSDKGraphRequest(graphPath: "me/photos", parameters: params as [NSObject : AnyObject], HTTPMethod: "POST").startWithCompletionHandler({ (connection, result, error) -> Void in

            if (error != nil) {
                DebugOutput("ERROR -> \(error)")
            }
            else {
                DebugOutput("SUCCESS (result) -> \(result)")
            }
        })
    }

现在我正在寻找解决方案,如何从FBSDKGraphRequest检索进度信息,以向用户显示需要多长时间。有没有人有一些提示或解决方案?

0 个答案:

没有答案