Sharekit - sending a url link to facebook
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:titleStri开发者_如何学JAVAng];
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];
}
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.
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.
精彩评论