0

在 Facebook 墙贴中,如何为“名称”参数添加 URL(链接)。

NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                               StrImg, @"picture",
                               StrName, @"name",
                               emailBody, @"description",
                               actionLinksStr, @"actions",
                               nil];
4

2 回答 2

0

以键为链接向字典添加另一个参数

仅供参考:https ://developers.facebook.com/docs/reference/api/post/

于 2012-06-27T08:19:58.897 回答
0

你可以这样做:

NSURL *url = [NSURL URLWithString:@"https://graph.facebook.com/me/feed"]; 
ASIFormDataRequest *newRequest = [ASIFormDataRequest requestWithURL:url]; 
[newRequest setPostValue:message forKey:@"message"];
[newRequest setPostValue:accessToken forKey:@"access_token"]; 
[newRequest setPostValue:imageURL forKey:@"picture"];
[newRequest setPostValue:attachmentName forKey:@"name"]; 
[newRequest setPostValue:attachmentCaption forKey:@"caption"]; 
[newRequest setPostValue:attachmentDescription forKey:@"description"]; 
[newRequest setPostValue:href forKey:@"link"];
//[newRequest setPostValue:@"http://www.foo.com/bar.swf" forKey:@"source"];
[newRequest setDidFinishSelector:@selector(postToWallFinished:)]; 
[newRequest setDelegate:self]; 
[newRequest startAsynchronous];

或者您可以在共享资源的元标记中设置参数:

NSURL *url = [NSURL URLWithString:@"https://graph.facebook.com/me/feed"]; 
ASIFormDataRequest *newRequest = [ASIFormDataRequest requestWithURL:url]; 
[newRequest setPostValue:message forKey:@"message"]; 
[newRequest setPostValue:href forKey:@"link"]; 
[newRequest setPostValue:accessToken forKey:@"access_token"]; 
[newRequest setDidFinishSelector:@selector(postToWallFinished:)]; 
[newRequest setDelegate:self];
[newRequest startAsynchronous];

和:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en" xmlns:og="http://ogp.me/ns#">

<head>
    <title>Foobar</title>
    <!-- Facebook meta tags -->
    <meta property="og:title" content="meta title"/>
    <meta property="og:url" content="http://www.foo.com"/>
    <meta property="og:image" content="http://www.foo.com/bar.png"/>
    <meta property="og:site_name" content="meta site name"/>
    <meta property="fb:admins" content="123"/>
    <meta property="og:description" content="meta description"/>
    <meta property="og:type" content="website"/>
    <!-- <meta property="og:video" content="http://www.foo.com/bar.swf"/> -->
    <!-- <meta property="og:video:width" content="1200"/> -->
    <!-- <meta property="og:video:height" content="800"/> -->
    ...
于 2012-06-27T09:55:30.087 回答