如何在NSString中为Facebook stream.publish插入换行符 [英] How insert linebreaks in NSString for Facebook stream.publish
本文介绍了如何在NSString中为Facebook stream.publish插入换行符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我看到Facebook上的某些应用程序可以将带有换行符的墙消息发布到用户墙上,像这样:
I saw some applications on Facebook can post to user wall messages with linebreaks - like that:
- blablabla
- blablabla 等等
- blablabla
- blablabla etc
我的代码将此文本放在Facebook上-"1. blablabla 2. blablabla等" 如何在Facebook的stream.publish的描述部分插入换行符
My code put this text on Facebook - "1. blablabla 2. blablabla etc" How can I insert linebreak in description part of stream.publish in Facebook
\ 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];}
推荐答案
我使用属性,例如:
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,但您明白了
P.S ^^Javascript, but you get the idea
这篇关于如何在NSString中为Facebook stream.publish插入换行符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文