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

问题描述

我可以使用以下代码与 Facebook 共享文本、图片和网址.

_lblTitle.text=@"Joe 在 24.53 使用 http://www.outsideinteractive.com 在尼亚加拉瀑布 5k 上跑了 3.10 英里";NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:_lblTitle.text, @"name",数据,@"图片",零];//发出请求[FBRequestConnection startWithGraphPath:@"/me/photos"参数:参数HTTPMethod:@"POST"completionHandler:^(FBRequestConnection *connection, id 结果, NSError *error) {如果(!错误){//链接成功发布到 FacebookNSLog([NSString stringWithFormat:@"result: %@", result]);} 别的 {//发生错误,我们需要处理错误//见:https://developers.facebook.com/docs/ios/errorsNSLog([NSString stringWithFormat:@"%@", error.description]);}}];

但现在我想分享超链接(有链接的文字).

示例:Joe 于 24.53 使用 创建自定义故事.

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 共享超链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 20:47