与iOS应用程序分享超链接到Facebook [英] Sharing hyperlink with facebook from iOS app

查看:476
本文介绍了与iOS应用程序分享超链接到Facebook的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  _lblTitle.text = @Joe刚刚在24.53的尼亚加拉瀑布5k跑了3.10英里,与http://www.outsideinteractive.com; 

NSMutableDictionary * params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
_lblTitle.text,@name,
data,@picture,
nil];

//请求
[FBRequestConnection startWithGraphPath:@/ me / photos
参数:params
HTTPMethod:@POST
completionHandler :(FBRequestConnection * connection,id result,NSError * error){
if(!error){
//链接成功发送到Facebook
NSLog([NSString stringWithFormat:@result: %@,result]);
} else {
//发生错误,我们需要处理错误
//参见:https://developers.facebook.com/docs/ios/errors
NSLog([NSString stringWithFormat:@%@,error.description]);
}
}];

但现在我想分享超链接(文本有链接)。



示例:
Joe在24.53的Virtual Niagara Falls 5k课程中跑了3.10英里,其中创建自定义故事。


I am able to share text, picture and url with facebook using following code.

_lblTitle.text=@"Joe just ran 3.10 miles on the Niagara Falls 5k in 24.53 with http://www.outsideinteractive.com";

NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                                   _lblTitle.text, @"name",
                                   data, @"picture",
                                   nil];

    // Make the request
    [FBRequestConnection startWithGraphPath:@"/me/photos"
                                 parameters:params
                                 HTTPMethod:@"POST"
                          completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
                            if (!error) {
                              // Link posted successfully to Facebook
                              NSLog([NSString stringWithFormat:@"result: %@", result]);
                            } else {
                              // An error occurred, we need to handle the error
                              // See: https://developers.facebook.com/docs/ios/errors
                              NSLog([NSString stringWithFormat:@"%@", error.description]);
                            }
                          }];

But now I want to share hyperlink (text having link).

Example: Joe just ran 3.10 miles on the Virtual Niagara Falls 5k Course in 24.53 with Outside Interactiive.

Currently I am able to share like this:
Joe just ran 3.10 miles on the Niagara Falls 5k in 24.53 with http://www.outsideinteractive.com

Note:I am also sharing picture in current functionality, And I want to continue with that.

Desired Result:

解决方案

After searching a lot I got the solution. This is possible only by Facebook Open Graph Story.

You will have to create custom Story using Facebook Developer Website and integrate it properly with your ios app.

Follow this link to create custom story.

这篇关于与iOS应用程序分享超链接到Facebook的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆