gpt4 book ai didi

ios - 从 iOS 应用程序与 Facebook 分享超链接

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:40:05 26 4
gpt4 key购买 nike

我可以使用以下代码与 facebook 共享文本、图片和 url。

_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]);
}
}];

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

示例:Joe 刚刚在 Virtual Niagara Falls 5k Course 上以 24.53 的成绩跑了 3.10 英里 Outside Interactiive .

目前我可以这样分享:
Joe 刚刚在 Niagara Falls 5k 上以 24.53 的成绩跑了 3.10 英里 http://www.outsideinteractive.com

注意:我也在当前功能中分享图片,我想继续这样做。

期望的结果: enter image description here

最佳答案

NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
@"Sharing Tutorial", @"name",
@"Build great social apps and get more installs.", @"caption",
@"Allow your users to share stories on Facebook from your app using the iOS SDK.", @"description",
@"https://developers.facebook.com/docs/ios/share/", @"link",
@"http://i.imgur.com/g3Qc1HN.png", @"picture",
nil];

你可以像这样制作一个字典并将它传递给你的函数,它会包含你想要的内容

或者类似的东西

FBShareDialogParams *params = [[FBShareDialogParams alloc] init];
params.link = [NSURL URLWithString:@"https://developers.facebook.com/docs/ios/share/"];
params.name = @"Sharing Tutorial";
params.caption = @"Build great social apps and get more installs.";
params.picture = [NSURL URLWithString:@"http://i.imgur.com/g3Qc1HN.png"];
params.description = @"Allow your users to share stories on Facebook from your app using the iOS SDK.";

关于ios - 从 iOS 应用程序与 Facebook 分享超链接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22088022/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com