【发布时间】:2011-01-15 19:17:05
【问题描述】:
我看到 Facebook 上的一些应用程序可以将带有换行符的消息发布到用户墙上 - 就像这样:
- blablabla
- blablabla 等等
我的代码将此文本放在 Facebook 上 - “1. blablabla 2. blablabla 等” 如何在 Facebook 的 stream.publish 的描述部分插入换行符
\n - 不工作
我的代码是
- (void)publishTopToStream{
NSMutableString *topTenArrayString=[[NSMutableString alloc] initWithFormat:@""];
for (int i=0; i<7; i++) {
NSString *tempString = [[NSString alloc] initWithFormat:@"%d. %@\n ",i+1,[[topTenArray objectAtIndex:i] personName]];
[topTenArrayString appendString:tempString];
[tempString release];
}
SBJSON *jsonWriter = [[SBJSON new] autorelease];
NSDictionary* attachment = [NSDictionary dictionaryWithObjectsAndKeys:
@"Top 7 friends", @"name",
@"Top 7 friends", @"caption",
topTenArrayString, @"description",
@"http://www.qqq.net/", @"href",
nil];
NSString *attachmentStr = [jsonWriter stringWithObject:attachment];
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
kAppId, @"api_key",
@"Share on Facebook", @"user_message_prompt",
attachmentStr, @"attachment",
nil];
[_facebook dialog: @"stream.publish"
andParams: params
andDelegate:self];}
【问题讨论】: