我看到Facebook上的一些应用程序可以发布带有换行符的用户留言 - 就像那样:
我的代码将此文本放在Facebook上 - “1。blablabla 2. blablabla etc” 如何在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];}
答案 0 :(得分:0)
我不知道这是否有用,但你试过吗? 这是一个回车,而不是换行。
答案 1 :(得分:0)
我使用属性,例如:
attachment = {
name: Super Application Posr
href: 'http://apps.facebook.com/superapplication/',
caption: 'blahh blahh',
description: 'Here is a list of the top Smelly people in the world' ,
properties: {
1: "Mr Moo",
2: "Mrs Moo",
3: "Mr Sheep",
4: "me"
}
}
P.S ^^ Javascript,但你明白了
答案 2 :(得分:0)
我不确定你是否还在这,但这对我有用:Posting attachments with Facebook Graph API using iPhone SDK