我有这样的请求网址:
https://myserver.com/api/news/?offset=0?
在参数dict中,我这样传递:
@ {@" offset" :@(0)}
为什么我的请求结束时出现问号,如何摆脱它?
请求后我记录了这样的完整信息:
NSLog(@"%@ | URL - %@?%@", sessionDataTaskGETReq.originalRequest.HTTPMethod,
sessionDataTaskGETReq.originalRequest.URL,
[[NSString alloc] initWithData:sessionDataTaskGETReq.originalRequest.HTTPBody encoding:NSUTF8StringEncoding]);
在这里,我在最后看到了这个额外的问号。
我的请求和响应序列化程序如下所示:
AFJSONRequestSerializer *requestSerializer = [AFJSONRequestSerializer serializer];
[requestSerializer setValue:@"application/json, multipart/form-data, @text/html" forHTTPHeaderField:@"Accept"];
AFJSONResponseSerializer *responseSerializer = [AFJSONResponseSerializer
serializerWithReadingOptions:NSJSONReadingAllowFragments];;
responseSerializer.acceptableContentTypes = [NSSet setWithArray:@[@"multipart/form-data", @"text/html", @"text/json", @"application/json"]];
答案 0 :(得分:2)
NSLog(@"%@ | URL - %@%@", sessionDataTaskGETReq.originalRequest.HTTPMethod,
sessionDataTaskGETReq.originalRequest.URL,
[[NSString alloc] initWithData:sessionDataTaskGETReq.originalRequest.HTTPBody encoding:NSUTF8StringEncoding]);
只需删除您在NSLog中添加的问号