Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/facebook/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c Facebook共享本地图像而不是NSURL图像_Objective C_Facebook_Facebook Graph Api_Swift - Fatal编程技术网

Objective c Facebook共享本地图像而不是NSURL图像

Objective c Facebook共享本地图像而不是NSURL图像,objective-c,facebook,facebook-graph-api,swift,Objective C,Facebook,Facebook Graph Api,Swift,Facebook共享publish\u actions使用NSURL检索图像进行共享。使用swift将UIImage而不是NSURL传递到facebook是否有解决方法 UIImage:fbShareImage应用作图像,而不是NSURL func shareFB() { var indexPath: NSIndexPath = self.tableView.indexPathForRowAtPoint(reportBtnPos!)! var params = FBLinkSha

Facebook共享
publish\u actions
使用NSURL检索图像进行共享。使用swift将UIImage而不是NSURL传递到facebook是否有解决方法

UIImage:
fbShareImage
应用作图像,而不是NSURL

func shareFB() {
    var indexPath: NSIndexPath = self.tableView.indexPathForRowAtPoint(reportBtnPos!)!
    var params = FBLinkShareParams()
    params.link = NSURL(string: "http://www.stackoverflow.com")
    params.linkDescription = self.photoNames[indexPath.row]

    let indexCell = tableView.cellForRowAtIndexPath(indexPath) as FeedCell!;
    var fbShareImage = indexCell.mainRestaurantImageView!.image

    println("params.link:\(params.link)")
    if fbShareImage == nil || "title" == ""
    {
        params.picture = nil
    }
    else{
        params.picture = fbShareImage
    }
    // If the Facebook app is installed and we can present the share dialog
    if  FBDialogs.canPresentShareDialogWithParams(params) == true
    {
        FBDialogs.presentShareDialogWithParams(params, clientState: nil, handler: {
            call, results, error in
            if error != nil{
                println("Failed!")
            }
            else{
                println("Success!")
            }
        })
    }
    else
    {
        // FALLBACK: publish just a link using the Feed dialog
        // Put together the dialog parameters
        var paramsDic = [
            "description": params.linkDescription,
            "link": "URL here",
        ]
        if params.picture != nil
        {
            paramsDic = [
                "description": params.linkDescription,
                "link": "link here",
                "picture": "IMAGE URL"]
        }

        // show the feed dialog
        FBWebDialogs.presentFeedDialogModallyWithSession(nil, parameters: paramsDic, handler: {
            result, resultURL, error in
            println("result==>>>\(result.hashValue)")
            if  result.hashValue == 1
            {
                println("Failed!")
            }
            else
                if result.hashValue == 0
                {
                    println("Success!")
            }
        })
    }
}

你找到办法了吗?我们可以用图片而不是url发布链接吗?