开发者社区> 问答> 正文

AFNetworking请求格式问题吗??? 400 报错

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 

展开
收起
爱吃鱼的程序员 2020-06-04 11:52:42 711 0
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

    报错  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);
        }];

    2020-06-04 16:45:21
    赞同 展开评论 打赏
问答地址:
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载