我正在开发一个将餐馆信息发布到用户Facebook墙上的应用程序。一切正常,但我不知道如何在JSON代码的“description”部分中插入新行。我的相关代码如下:
FBStreamDialog* dialog = [[[FBStreamDialog alloc] init] autorelease];
dialog.userMessagePrompt = @"Enter your message:";
dialog.attachment = [NSString stringWithFormat:@"{\"name\":\"Check out this great restaurant!\",\"href\":\"/\",\"caption\":\"%@\",\"description\":\"%@ /*NEW LINE HERE*/%@, %@ /*NEW LINE HERE*/%@\",\"media\":[{\"type\":\"image\",\"src\":\"http://www.myhost.ca/images/image_IC_B_03.png\",\"href\":\"http://www.myhost.com/\"}]}",
restaurantObj.name, restaurantObj.address, restaurantObj.city, restaurantObj.provinceState, restaurantObj.phoneNumber];
dialog.actionLinks = @"[{\"text\":\"Download this app!\",\"href\":\"http://www.myhost.com/\"}]";
[dialog show];
我试图插入\ n而且我试图在我上面标记的地方插入\ r \ n,但不幸的是,这不起作用。有人有解决方案吗?