随笔记一下 好用的小技巧
1.将字典数据拼接成url的参数...
AFQueryStringFromParameters
NSString *query = AFQueryStringFromParameters(parameters);
//创建临时URL
NSURL *tempURL = [NSURL URLWithString:URLString];
//如果之前URL有附带参数,则附加上去
NSURL *new = [NSURL URLWithString:[NSString stringWithFormat:tempURL.query ? @"%@&%@" : @"%@?%@", URLString, query]];
2.对url进行utf-8编码
AFPercentEscapedStringFromString(NSString * _Nonnull string)
AFPercentEscapedStringFromString(URLString);