旅行アプリの添付ファイルとしてFacebookに旅程を投稿しようとしています。NSMutableStringを使用してすべての旅程のイベントと日付を追加していますが、イベントの後に改行を入れる方法がわかりません。
これは私のコードです:
- (void)postItineraryToWall:(NSArray*)itineraryList{
NSMutableString *description = [NSMutableString string];
for (Itinerary *it in itineraryList) {
[description appendString:[NSString stringWithFormat:@"Evento: %@", it.event]];
[description appendString:[NSString stringWithFormat:@" en %@", it.place]];
[description appendString:[NSString stringWithFormat:@" el %@", it.eDate]];
}
FBStreamDialog* dialog = [[[FBStreamDialog alloc] init] autorelease]; dialog.userMessagePrompt = @"Enter your message:"; dialog.attachment = [NSString stringWithFormat:@"{\"name\":\"Conectado desde TravelFan iPhone App\",\"caption\":\"Compartiendo itinerario\",\"description\":\"%@ \",\"media\":[{\"type\":\"image\",\"src\":\"http://www.site.com.mx/content/templates/default/images/logo_travel.jpg\",\"href\":\"http://www.site.com.mx/\"}]}", description]; dialog.actionLinks = @"[{\"text\":\"Obten App!\",\"href\":\"http://www.site.com.mx/\"}]"; [dialog show];
}
最後に追加された文字列に\nを使用してみましたが、添付ファイルにはすでに多くの\と "が含まれる文字列形式であるため、テストすると添付ファイルのテキストは表示されず、\nなしでテストするとすべてが表示されます。このような1行:
イベント:ある美術館での博覧会2011年12月12日12:00イベント:ある美術館での博覧会2011年12月
13日13:00...。
そして、私はそれをこのように見せたいです:
イベント:ある美術館での博覧会2011年12月12日12:00
イベント:ある美術館での博覧会2011年12月13日13:00
...。
編集:\ nを使用してNSLogで印刷すると、すべてが希望どおりになりますが、添付テキストがFacebookダイアログ画面に表示されないため、\nは添付テキスト全体に影響します。
誰かがこれで私を助けることができることを願っています。よろしくお願いします!! XD