-1

使用 JSONMODEL 访问 Web 服务时出现以下错误。

“错误域=JSONModelErrorDomain 代码=2”网络响应错误。可能 JSON URL 无法访问。“UserInfo=0xa1aeea0 {NSLocalizedDescription=网络响应错误。可能 JSON URL 无法访问。}”

这是我的代码

NSDate *currentDate=[NSDate date];
NSDictionary *dict=[NSDictionary dictionaryWithObjectsAndKeys:@"100",@"userId",@"ios",@"platform",currentDate,@"currentDate",@"1",@"numberOfPage",@"10",@"numberOfRowToFetch",@"1",@"category",nil];
NSString  *urlStr=[@"http://www.lptpl.tk/teleshka/admin/index.php?r=jsoner/homeProductList" stringByReplacingOccurrencesOfString:@" " withString:@""];
[JSONHTTPClient postJSONFromURLWithString:urlStr params:dict completion:^(id json, JSONModelError *err){
    LoginDataModelClass *responce = [[LoginDataModelClass alloc] initWithDictionary: json error:nil]; 
   [[NSNotificationCenter defaultCenter] postNotificationName:Login_Responce object:responce];
}];

2.传递正文字符串时发生以下错误。

“此服务器的证书无效。您可能正在连接到伪装成“lptpl.tk”的服务器,这可能会使您的机密信息面临风险。”

4

1 回答 1

0

我自己解决了。问题是我传递了一个日期类型参数,而 json 模型只支持字符串类型或数字类型参数。

于 2015-07-01T05:13:51.823 回答