在iOS上的NSDictionary字符串中使用占位符

在iOS上的NSDictionary字符串中使用占位符,ios,nsstring,nsdictionary,placeholder,Ios,Nsstring,Nsdictionary,Placeholder,我正试图为Facebook帖子制作一本词典,并试图找出如何在我的字符串中使用占位符。我目前有: NSDictionary *parameters = @{@"message" : @"I'm reading today.", @"caption": (@"I'm on %@", _entry.date), @"link": _entry.articleUrl}; _entry.date是一个字符串,显示用户在哪一天阅读,而_entry.articleUrl是用户正在阅读的页面的字符串。我的问题

我正试图为Facebook帖子制作一本词典,并试图找出如何在我的字符串中使用占位符。我目前有:

NSDictionary *parameters = @{@"message" : @"I'm reading today.", @"caption": (@"I'm on %@", _entry.date), @"link": _entry.articleUrl};

_entry.date是一个字符串,显示用户在哪一天阅读,而_entry.articleUrl是用户正在阅读的页面的字符串。我的问题是获取正确的格式,以便用于标题的字符串可以有文本和字符串的占位符。现在它告诉我表达式结果未使用。

尝试使用此字符串api来构建字符串:

NSDictionary *parameters = @{@"message" : @"I'm reading today.", @"caption": [NSString stringWithFormat:@"I'm on %@", _entry.date], @"link": _entry.articleUrl};

尝试使用此字符串api构建字符串:

NSDictionary *parameters = @{@"message" : @"I'm reading today.", @"caption": [NSString stringWithFormat:@"I'm on %@", _entry.date], @"link": _entry.articleUrl};

您是否试图通过将格式用括号括起来从格式生成字符串?是否试图通过将格式用括号括起来从格式生成字符串?完美。我知道一定是那样的,只是没法把它记下来。太好了。我知道一定是那样的,只是没法把它记下来。