Sharekit - 向facebook发送网址链接

时间:2011-05-16 22:54:27

标签: iphone objective-c ios facebook sharekit

以下是我使用Sharekit将图像和标题发送到Facebook的方法。我还想发一个URL和facebook帖子。如果我试试

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

2 个答案:

答案 0 :(得分:1)

没有方法-[SHKItem image:url:title:]。因此提出了一个错误。目前没有使用 ShareKit 执行所需操作的机制,因此您必须根据需要自定义ShareKit。您还应该查看Graph API

答案 1 :(得分:0)

也许你想要的是一个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];

我用最新的sharekit实现了它,它对我有用。