0
我使用附件与Facebook分享,除了与附件名称(名称显示,但不是URL)关联的URL之外,所有内容均可用。这是做这件事的'老'方式,但'新'方式有完全相同的结果。引用URL时,我也必须使用链接和href(在两个不同的地方)。有趣的是,如果名称URL和图像href网址相同,则一切正常。所有字段/网址均有效。谢谢。名称URL不适用于Facebook附件
SBJSON *jsonWriter = [[SBJSON new] autorelease];
NSArray* actionLinks = [NSArray arrayWithObjects:[NSDictionary dictionaryWithObjectsAndKeys:
APP_GET, @"text",
APP_URL, @"href",
nil], nil];
Mix *currentMix = [MixPlayer sharedPlayer].currentMix;
NSString *actionLinksStr = [jsonWriter stringWithObject:actionLinks];
NSDictionary* imageShare = [NSDictionary dictionaryWithObjectsAndKeys:
@"image", @"type",
currentMix.coverURL, @"src",
currentMix.mixUrl, @"href",
nil];
NSDictionary* attachment = [NSDictionary dictionaryWithObjectsAndKeys:
currentMix.title, @"name", // this won't appear as a URL
@"company.com", @"caption",
currentMix.description, @"description",
currentMix.mixUrl, @"link", // "href" breaks the attachment
[NSArray arrayWithObjects:imageShare, nil], @"media",
nil];
NSString *attachmentStr = [jsonWriter stringWithObject:attachment];
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
kAppId, @"api_key",
@"Share on Facebook", @"user_message_prompt",
actionLinksStr, @"action_links",
attachmentStr, @"attachment",
nil];
[[delegate sharedFacebook] dialog:@"stream.publish" andParams:params andDelegate:delegate];