3

(これは実際にはこの質問と同じですが、与えられた回答は関連性がありませんでした

シェアキットでFacebookに画像と説明を追加します

共有されたときに次のように表示されるように、ShareKit を使用して画像へのリンクを送信するにはどうすればよいですか。

ここに画像の説明を入力

または、何かが投稿されたときに常に大きなアイコンを表示するように FB アプリを設定できますか?

4

4 に答える 4

3

(私の質問に答えて)

ファイル 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];
于 2011-08-19T15:42:26.707 に答える
1
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 ];
于 2012-08-10T17:15:49.080 に答える
0

これが答えの私の修正であり、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)];
于 2012-04-25T05:58:24.250 に答える
0

または、画像と説明をパラメーターとして編集するための別のソリューションがここにあります

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];
于 2012-04-25T06:30:34.937 に答える