Json Model Error

896 views Asked by At

Getting the following error while using JSONMODEL to hit a web service.

"Error Domain=JSONModelErrorDomain Code=2 "Bad network response. Probably the JSON URL is unreachable." UserInfo=0xa1aeea0 {NSLocalizedDescription=Bad network response. Probably the JSON URL is unreachable.}"

Here is my Code

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.Following error occured while passing body string.

"The certificate for this server is invalid. You might be connecting to a server that is pretending to be “lptpl.tk” which could put your confidential information at risk."

1

There are 1 answers

0
rohit chauhan On

I solved it by my own.Problem was that i was passing a date type parameter, while json model only support either String Type or number Type parameters.