我正在尝试请求以下 URL,但收到一条错误消息,提示“数据参数为 nil”。我发现“seller_name”有空间,“amount”有点(。)。我认为这是由 URL 引起的问题。那么有没有办法在不丢失信息的情况下发送具有空格和点的 URL?
NSURL *url1 = [[NSURL alloc]initWithString:[NSString stringWithFormat:@"192.168.1.85/localex_postsale.html?contactid=%@&exchangeid=%@&token=%@&buyerid=%@&seller_name=%@&desc=%@&amount=%@&sellerid=%@",contactid,exchangeid,token,buyervalue,sellers,_Description,_Amount,contactid]];
NSError *errors1;
NSData *data1 = [NSData dataWithContentsOfURL:url1];
NSDictionary *json1 = (NSDictionary *)[NSJSONSerialization JSONObjectWithData:data1 options:kNilOptions error:&errors1];