Search code examples
iphoneobjective-ciosfacebooksharekit

ShareKit - posting linked image to facebook wall


( 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:

enter image description here

Or, alternatively, can I set the FB app to always show the big icon when something is posted?


Solution

  • (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];