(これは実際にはこの質問と同じですが、与えられた回答は関連性がありませんでした
共有されたときに次のように表示されるように、ShareKit を使用して画像へのリンクを送信するにはどうすればよいですか。
または、何かが投稿されたときに常に大きなアイコンを表示するように FB アプリを設定できますか?
(これは実際にはこの質問と同じですが、与えられた回答は関連性がありませんでした
共有されたときに次のように表示されるように、ShareKit を使用して画像へのリンクを送信するにはどうすればよいですか。
または、何かが投稿されたときに常に大きなアイコンを表示するように FB アプリを設定できますか?
(私の質問に答えて)
ファイル SHKfacebook.m を変更して、dialog.attachment 行を次のように変更しました。
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)];
(貼り付けてから1行にしてください)
画像 URL - http://example.com/example.png - 約 76 X 90px とリンク URL - http://example.com/があることがわかります。
共有タイプを明示的に設定する必要がある場合もあります。3G/3GS iPhone では、これを行わないと機能しないことに気付きました。
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 ];
これが答えの私の修正であり、Facebookに共有するときにタイトル、画像、および説明を共有できます。楽しめ
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)];
または、画像と説明をパラメーターとして編集するための別のソリューションがここにあります
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 = @"";
次のようにパラメータを渡すだけです。
SHKItem *itemfb = [SHKItem image:@"" title:@"TITLE" url:url2];
itemfb.shareType = SHKShareTypeURL;
itemfb.text = @"DESCRIPTION COME HERE";
itemfb.filename = @"IMAGE PATH";
[SHKFacebook shareItem:itemfb];