Objective c Facebook共享本地图像而不是NSURL图像
Facebook共享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
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发布链接吗?