ShareKit – posting linked image to facebook wall

4 Solutions Collect From Internet About “ShareKit – posting linked image to facebook wall”

(answering my question)

I changed the file SHKfacebook.m changing the dialog.attachment line to read:

dialog.attachment = [NSString stringWithFormat:@"{\"name\":\"%@\",\"href\"
,\"href\": \"\"}]} ",item.title == nil ? SHKEncodeURL(item.URL) 

(make it one line after you paste in)

You can see there is an image url – – which should be about 76 X 90px, and a link url –

You may also need to explicitly set the sharetype. I’ve noticed on 3G/3GS iPhones then it doesn’t work unless you do this:

item.shareType = SHKShareTypeURL;
[SHKFacebook shareItem:item];
SHKFacebook * sharer = [ [ [ SHKFacebook alloc ] init] autorelease ];
SHKItem * item = [ SHKItem URL:[ NSURL URLWithString:@"" ]
                         title:@"my title"
                   contentType:SHKURLContentTypeUndefined ];
item.facebookURLShareDescription = @"my description";
item.facebookURLSharePictureURI = @"";
[ sharer loadItem:item ];
[ sharer share ];

Here is my amendment for the answer and it can share the title, image and the description when share to facebook. Enjoy it

dialog.attachment = [NSString stringWithFormat:@"{\"name\":\"%@\",\"href\":\"%@\",\"description\":\"%@\",\"media\":[{\"type\":\"image\",\"src\":\"\" ,\"href\": \"%@/\"}]} ",item.title == nil ? SHKEncodeURL(item.URL) : SHKEncode(item.title),SHKEncodeURL(item.URL), @"Testing Description Comes Here", SHKEncode(SHKMyAppURL)];

Or another solution comes here for editing the image and description as parameters

dialog.attachment = [NSString stringWithFormat:@"{\"name\":\"%@\",\"href\":\"%@\",\"description\":\"%@\",\"media\":[{\"type\":\"image\",\"src\":\"%@\" ,\"href\": \"%@/\"}]} ",item.title == nil ? SHKEncodeURL(item.URL) : SHKEncode(item.title),SHKEncodeURL(item.URL), item.text, item.filename, SHKEncode(SHKMyAppURL)];
dialog.userMessagePrompt = SHKLocalizedString(@"Enter your message:");
dialog.defaultStatus = @"";

By passing the parameters simply like this:

SHKItem *itemfb = [SHKItem image:@"" title:@"TITLE" url:url2];
        itemfb.shareType = SHKShareTypeURL;
        itemfb.text = @"DESCRIPTION COME HERE"; 
        itemfb.filename = @"IMAGE PATH";
        [SHKFacebook shareItem:itemfb];