NSString没有正确显示

She*_*lam 2 iphone cocoa cocoa-touch objective-c nsstring

我有以下NSString:

NSString* searchURL = [NSString stringWithFormat:@"http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.quotes%20where%20symbol%20in%20(%22%@%22)%0A%09%09&format=json&env=http%3A%2F%2Fdatatables.org%2Falltables.env&callback=",symbol];  
    NSLog(@"URL IS: %@", searchURL);
Run Code Online (Sandbox Code Playgroud)

看起来%22在打印时不包括在内:

URL IS: http://query.yahooapis.com/v1/public/yql?q=select220from2ahoo.finance.quotes2here              `º?ymbol              813020n22@20X1.000982B6P-1042009&format=json&env=http0X1.8CFB8P-1023-1.9907460.000000datatables.org-1.990746alltables.env&callback=
Run Code Online (Sandbox Code Playgroud)

如何确保%22包含在我的字符串中?

siu*_*nin 7

如果要在格式字符串中包含"%"符号,请使用"%%"

就像printf等人一样.

阅读stringWithFormat的完整文档,以避免其他不良意外...