其他分享
首页 > 其他分享> > *** Assertion failure in -[AFJSONRequestSerializer requestWithMethod:URLString:parameters:error:],

*** Assertion failure in -[AFJSONRequestSerializer requestWithMethod:URLString:parameters:error:],

作者:互联网

在使用AFNetworking时,如果Url中包含空格,文字,或者特殊字符时,会崩溃:

[AFJSONRequestSerializer requestWithMethod:URLString:parameters:error:]

解决办法:

NSString *url = [NSString stringWithFormat:@"请求的链接"];

NSString *requestUrl = [url stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]]; 

标签:parameters,url,Assertion,AFJSONRequestSerializer,requestWithMethod,NSString,URLS
来源: https://www.cnblogs.com/kimiyo/p/11193020.html