我正在接收一个json数据对象,然后从中提取一个字符串。
NSDictionary *jsonDictionary = [NSJSONSerialization JSONObjectWithData:data
options:0
error:nil];
NSString *country=jsonDictionary[@"address"][@"country"];
然后,我尝试使该字符串适合在URL中使用
NSString *newCountryString = [country stringByReplacingOccurrencesOfString:@" "
withString:@"%%20"];
但是它不起作用。
如果我硬编码newCountryString,它就能工作,为什么呢?
https://stackoverflow.com/questions/21403323
复制相似问题