Sharekit - 发送 url 链接到 Facebook

发布于 2024-11-08 08:05:16 字数 938 浏览 0 评论 0原文

下面是我使用 Sharekit 将图像和标题发送到 Facebook 的方法。我还想随 Facebook 帖子一起发送 URL。如果我尝试,

SHKItem *item = [SHKItem image:image url:url title:titleString];

我会收到太多参数错误消息。有谁对如何做到这一点有任何想法?感谢您的帮助。

- (IBAction)myButtonHandlerAction
    {               
                    NSURL *url = [NSURL URLWithString:@"http://example.com/"];
                NSString *titleString = [[NSString alloc] initWithFormat:@"*** %@ * \n\nGet the ***** App - It's Free!", entity.name];

                UIImage *image = [[[UIImage alloc] initWithData:entity.image] autorelease];     

                SHKItem *item = [SHKItem image:image title:titleString];

                // Get the ShareKit action sheet
                SHKActionSheet *actionSheet = [SHKActionSheet actionSheetForItem:item];

                // Display the action sheet
                [actionSheet showFromBarButtonItem:barbtn animated:YES];
}

Below is the method I'm using with Sharekit to send an image and a title to facebook. I also want to send a URL along with the facebook post. If I try

SHKItem *item = [SHKItem image:image url:url title:titleString];

I get a too many arguments error message. Does anyone have any ideas on how this should be done? thanks for any help.

- (IBAction)myButtonHandlerAction
    {               
                    NSURL *url = [NSURL URLWithString:@"http://example.com/"];
                NSString *titleString = [[NSString alloc] initWithFormat:@"*** %@ * \n\nGet the ***** App - It's Free!", entity.name];

                UIImage *image = [[[UIImage alloc] initWithData:entity.image] autorelease];     

                SHKItem *item = [SHKItem image:image title:titleString];

                // Get the ShareKit action sheet
                SHKActionSheet *actionSheet = [SHKActionSheet actionSheetForItem:item];

                // Display the action sheet
                [actionSheet showFromBarButtonItem:barbtn animated:YES];
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

你的背包 2024-11-15 08:05:16

没有方法 -[SHKItem image:url:title:]。因此会引发错误。目前,没有任何机制可以使用 ShareKit 执行您需要的操作,因此您必须根据您的需求自定义 ShareKit。您还应该查看Graph API

There is no method -[SHKItem image:url:title:]. So an error is being raised. Currently there is no mechanism to do what you require using ShareKit so you will have to customize ShareKit for your needs. You should also look at the Graph API.

赤濁 2024-11-15 08:05:16

也许您想要的是一个 url 项目,并附加一个图像。如果是这样,你可以这样做:

SHKItem *item = [SHKItem URL:[NSURL URLWithString:@"http://example.com/"] title:@"Check this link"];
[item setCustomValue:@"http://example.com/someimage.jpg" forKey:@"picture"];
[SHKFacebook shareItem:item];

我已经用最新的共享包实现了这个,它对我有用。

Maybe what you want is a url item, with an image attached to it. If so, you can do this :

SHKItem *item = [SHKItem URL:[NSURL URLWithString:@"http://example.com/"] title:@"Check this link"];
[item setCustomValue:@"http://example.com/someimage.jpg" forKey:@"picture"];
[SHKFacebook shareItem:item];

I've implemented this with the latest sharekit, it works for me.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文