我正在尝试使用这里给出的facebook发布API链接http://developers.facebook.com/docs/reference/api/post/
NSDictionary *privacyDict = [[[NSDictionary alloc] initWithObjectsAndKeys:@"SELF",@"value",nil] autorelease];
SBJSON *jsonWriter = [[SBJSON new] autorelease];
NSString *privacyJSONStr = [jsonWriter stringWithObject:privacyDict];
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
@"Test test", @"message",
privacyJSONStr, @"privacy",
@"http://www.facebook.com/", @"link",
@"This name check where it will show", @"name",
@"Caption for the link", @"caption",
@"Longer description of the link", @"description",
nil];
[facebookObj requestWithMethodName:@"facebook.Stream.publish" andParams:params andHttpMethod:@"POST" andDelegate:self];
它发布成功,但不像我预期的那样 没有标题,名称,描述,链接等 它显示为
我可以通过此参数获得此类型的结果
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
@"Test test", @"message",
privacyJSONStr, @"privacy",
nil];
错误是什么,以及我们如何发布所有参数
Amit Battan
答案 0 :(得分:0)
试试这个..它对我有用
- (IBAction )publishStream{
SBJSON *jsonWriter = [[SBJSON new] autorelease];
NSDictionary* actionLinks = [NSArray arrayWithObjects:[NSDictionary dictionaryWithObjectsAndKeys:
@"Posting From",@"text",@"http://www.google.com/",@"href", nil], nil];
NSString *actionLinksStr = [jsonWriter stringWithObject:actionLinks];
NSLog(@"Action Link String : %@", actionLinksStr);
NSDictionary* attachment = [NSDictionary dictionaryWithObjectsAndKeys:
@"Feed Name", @"name",
@"Feed Caption is here", @"caption",
@"Feed Description is here", @"description",
@"http://www.google.com/", @"href", nil];
NSString *attachmentStr = [jsonWriter stringWithObject:attachment];
NSLog(@"Attachment String : %@", attachmentStr);
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
@"Share on Facebook", @"user_message_prompt",
actionLinksStr, @"action_links",
attachmentStr, @"attachment",
nil];
[facebook dialog:@"facebook.Stream.publish"
andParams:params
andDelegate:self];
}