I am working on an app that posts restaurant information to the user’s Facebook wall. Everything works fine, except I don’t know how to insert a new line within the “description” section of the JSON code. My relevant code is as follows:
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];
I have tried to insert \n and I’ve tried to insert \r in the places I’ve marked above, but unfortunately that doesn’t work. Does anyone have a solution to this?
You can probably use the same workaround this guy found:
facebook c# sdk: Add/edit event with newlines in description