JSON文字列を作成するために使用しているPLISTから文字列データを読み取っています(ちなみにFacebook Connect内で使用するため)。
NSString *eventLink = [eventDictionary objectForKey:EVENT_FIND_OUT_MORE_KEY];
NSString *eventLinkEscaped = [eventLink stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSString *eventName = [eventDictionary objectForKey:EVENT_NAME_KEY];
NSString *eventDescription = [eventDictionary objectForKey:@"Description"];
NSString *eventImageAddress = [eventDictionary valueForKey:@"Image URL"];
if ([eventImageAddress length] == 0)
{
eventImageAddress = NO_EVENT_IMAGE_URL;
}
// Publish a story to the feed using the feed dialog
FBStreamDialog *facebookStreamDialog = [[[FBStreamDialog alloc] init] autorelease];
facebookStreamDialog.delegate = self;
facebookStreamDialog.userMessagePrompt = @"Publish to Facebook";
facebookStreamDialog.attachment =[NSString stringWithFormat: @"{\"name\":\"%@\",\"href\":\"%@\",\"description\":\"%@\",\"media\":[{\"type\":\"image\",\"src\":\"%@\",\"href\":\"%@\"}]}", eventName, eventLinkEscaped, eventDescription, eventImageAddress, eventLinkEscaped];
[facebookStreamDialog show];
これはすべてうまく機能しますが、特定のイベントの説明(約150のうち4つ)のダイアログに表示されるテキストは空白です。明らかな候補を見つけました。つまり、説明に「たとえば文字または著作権記号が含まれています。私の質問は、stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncodingなど、危険な文字をエスケープまたは無視する簡単なメソッド呼び出しがありますか?
前もって感謝します、
デイブ