0

私の問題を説明します。FacebookでURLを共有するためにiPhoneアプリで
使用しています。 URL を共有できますが、説明セクションには何もありません (空白のフィールドのみ)。 そして、私はいくつかのテキストを書きたいと思います。Sharekit

メソッド send のファイル SHHKFacebbok.m でこのコードを使用しています。

if (item.shareType == SHKShareTypeURL)
{
    self.pendingFacebookAction = SHKFacebookPendingStatus; 
    SHKFBStreamDialog* dialog = [[[SHKFBStreamDialog alloc] init] autorelease];
    dialog.delegate = self;

    dialog.userMessagePrompt = SHKLocalizedString(@"Votre réponse à cette question de merde:");
    dialog.attachment = [NSString stringWithFormat:
                         @"{\
                         \"name\":\"%@\",\
                         \"href\":\"%@\",\
                         \"media\":[{\"type\":\"image\",\"src\":\"http://www.samanddon.com/qdm.png\",\"href\":\"http://itunes.apple.com/fr/app/qdm/id453225639?mt=8\"}]\
                         }",
                         item.title == nil ? SHKEncodeURL(item.URL) : SHKEncode(item.title),
                         SHKEncodeURL(item.URL),
                         SHKEncodeURL(item.URL),
                         SHKEncodeURL(item.URL) 

                         ];

    dialog.defaultStatus = item.text;
    dialog.actionLinks = [NSString stringWithFormat:@"[{\"text\":\"Get %@\",\"href\":\"%@\"}]",
                          SHKEncode(SHKMyAppName),
                          SHKEncode(SHKMyAppURL)];
    [dialog show];

}

URLの説明を書く方法を知っている人はいますか?

4

2 に答える 2

1

これも試してみてください:
== SHKFacebook.m ==

if (item.shareType == SHKShareTypeURL)
{
    self.pendingFacebookAction = SHKFacebookPendingStatus;

    SHKFBStreamDialog* dialog = [[[SHKFBStreamDialog alloc] init] autorelease];
    dialog.delegate = self;
    dialog.userMessagePrompt = SHKLocalizedString(@"Enter your message:");
    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.description, item.picture,SHKEncodeURL(item.URL)
                         ];

    dialog.defaultStatus = item.text;
    dialog.actionLinks = [NSString stringWithFormat:@"[{\"text\":\"Get %@\",\"href\":\"%@\"}]",
                          SHKEncode(SHKMyAppName),
                          SHKEncode(SHKMyAppURL)];
    [dialog show];

}


== SHKItem.h ==
新しいアイテムを追加:

NSString *picture;
NSString *description;


および新しいプロパティ:

@property (nonatomic, retain)    NSString *picture;
@property (nonatomic, retain)   NSString *description;


== SHKItem.m について ==

 + (SHKItem *)URL:(NSURL *)url
{
    return [self URL:url title:nil description:nil picture:nil];
}

+ (SHKItem *)URL:(NSURL *)url title:(NSString *)title description:(NSString *)description picture:(NSString *)picture
{
    SHKItem *item = [[SHKItem alloc] init];
    item.shareType = SHKShareTypeURL;
    item.URL = url;
    item.title = title;
    item.description = description;
    item.picture = picture;

    return [item autorelease];
}


== 使い方 ==

SHKItem *item = [SHKItem URL:yoururl title:yourtitle description:yourdesc picture:yourpicture];
SHKActionSheet *actionSheet = [SHKActionSheet actionSheetForItem:item];
[actionSheet showFromToolbar:self.navigationController.toolbar];

乾杯!:D

于 2011-11-22T03:35:22.380 に答える
0

これを試して:

 dialog.attachment = [NSString stringWithFormat:
                                 @"{\
                                 \"name\":\"%@\",\
                                 \"href\":\"%@\",\
                                 \"description\":\"%@\",\
                                 \"media\":[{\"type\":\"image\",\"src\":\"http://www.apple.com/images/an_image.png.png\",\"href\":\"http://www.apple.com/\"}]\
                                 }",

                                 item.title == nil ? SHKEncodeURL(item.URL) : SHKEncode(item.title),
                                 SHKEncodeURL(item.URL),
                                 item.text
                                 ];

注:説明に「\n」のような改行を含めることはできません。それは私にはうまくいきません...それが役立つことを願っています。

于 2011-10-19T07:36:42.643 に答える