AFNetworking请求格式问题吗??? 400 报错 http://……/Wrisband/appheartbeat?BeginTime=20161103000000&EndTime=20161103113135&UserId=9628 请求没问题
http://……/Wrisband/appheartbeat?BeginTime=2016-11-03 00:00:00&EndTime=2016-11-03 11:31:35&UserId=9628 请求会崩
2016-11-03 11:31:35.506 ss[1243:154847] *** Assertion failure in -[AFHTTPRequestSerializer requestWithMethod:URLString:parameters:error:], /Users/rainheroickung/ssd/dd/ss/Lib/AFNetworking/AFURLRequestSerialization.m:314
2016-11-03 11:31:35.507 ss[1243:154847] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: URLString'
*** First throw call stack:
(0x1829b02d8 0x1941840e4 0x1829b0198 0x183864ed4 0x1001e0408 0x10015eb88 0x10015f24c 0x10020db8c 0x100181f24 0x10018096c 0x1873f0c84 0x1873f0994 0x18759325c 0x1874a5ef0 0x1874a5cbc 0x1874a5c3c 0x1873ed760 0x186d35e1c 0x186d30884 0x186d30728 0x186d2febc 0x186d2fc3c 0x186d29364 0x1829682a4 0x182965230 0x182965610 0x1828912d4 0x18c0af6fc 0x187456fac 0x1001f90b0 0x194802a08)
libc++abi.dylib: terminating with uncaught exception of type NSException
报错 IOS ‘NSInternalInconsistencyException‘, reason: ‘Invalid parameter not satisfying: URLString‘
翻译出来就是 不能满足urlstring, 可能时请求地址错了,但是请求地址没错,返回是一串json数据
这个url中参数是直接写上去的,然后parameters 放参数的地方 没放,后来我把参数单独写了进来,就搞定了啊!
这里的参数一定要写再 parameters 中,不然链接里的那些&符号(放入parameters后 可以省略,更简便)
NSString * urlStr_fir = @"http://……/Wrisband/appheartbeat?";
NSDictionary * param_Dict = @{@"BeginTime":beginTimeStr,@"EndTime":endTimeStr,@"UserId":user_ID};
[NetRequest GET:urlStr_fir parameters:param_Dict success:^(id resposeObject) {
NSLog(@"1请求成功 心率 resposeObject:%@",resposeObject);
//.........
} failure:^(NSError *error) {
NSLog(@"xxxx⤵️网络请求失败,错误:%@",error);
}];
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。