( this is really the same as this question, but the answer given was not relevant
add image and description on facebook with sharekit )
How do I send a link to an image with ShareKit, so that when shared, it appears like so:
Or, alternatively, can I set the FB app to always show the big icon when something is posted?
(answering my question)
I changed the file SHKfacebook.m changing the dialog.attachment line to read:
dialog.attachment = [NSString stringWithFormat:@"{\"name\":\"%@\",\"href\"
:\"%@\",\"media\":[{\"type\":\"image\",\"src\":\"http://example.com/example.png\"
,\"href\": \"http://example.com/\"}]} ",item.title == nil ? SHKEncodeURL(item.URL)
SHKEncode(item.title),SHKEncodeURL(item.URL)];
(make it one line after you paste in)
You can see there is an image url - http://example.com/example.png - which should be about 76 X 90px, and a link url - http://example.com/
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:@"http://google.com" ]
title:@"my title"
contentType:SHKURLContentTypeUndefined ];
item.facebookURLShareDescription = @"my description";
item.facebookURLSharePictureURI = @"http://www.userlogos.org/files/logos/pek/stackoverflow.png";
[ 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\":\"http://4.bp.blogspot.com/-77BXdZj0M6o/Tr0t9pndpOI/AAAAAAAAAQ4/j3KWIE9ov1E/s1600/Blue_Eye_by_SapphiraBlue.jpg\" ,\"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];
来源:https://stackoverflow.com/questions/7122414/sharekit-posting-linked-image-to-facebook-wall