新建一个NSString类别
.h文件中
/**
* 网络传输中防止转义
*
*/
- (NSString *)URLEncodedString;
.m文件中
- (NSString *)URLEncodedString
{
NSString *encodedString = [self stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet characterSetWithCharactersInString:@"!$&'()*+,-./:;=?@_~%#[]"].invertedSet];
return encodedString;
}