字典转json字符串转URL为空解决办法

写项目遇到字典转json字符串转URL为空这个坑。

记录一下,方便以后查找。

NSString *urlstr=[youString stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];

NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"%@", urlstr]];

这样处理一下字符串即可。

你可能感兴趣的:(字典转json字符串转URL为空解决办法)