我正在尝试在亚马逊上搜索电影标题,但 URL 有问题。电影名称以 '%@' 插入到链接中,但额外的 '%' 会导致问题。任何帮助,将不胜感激。
错误:
More '%' conversions than data arguments
Format specifies type 'int' but the argument has type 'NSString *'
这是我的代码:
- (void)jumpToAmazon:(id)sender {
// create the string that points to the correct Amazon page for the game name
NSString *amazonPageString = [NSString stringWithFormat:@"http://www.amazon.com/s/ref=nb_sb_noss_1?url=search-alias%3Dmovies-tv&field-keywords=%@&sprefix=friend%2Cmovies-tv&rh=i%3Amovies-tv%2Ck%3A%@", self.movie.name, self.movie.name];
if (![[UIApplication sharedApplication] openURL:[NSURL URLWithString:amazonPageString]])
{
// there was an error trying to open the URL. for the moment we'll simply ignore it.
}
}