I want to pass a JSON dictionary as a parameter by using uploadUrl
, but it gives me an Unsupported Url
error with code-1002.
When I hit this URL on Postman, it works perfectly. How do I implement this using a JSON model?
NSString *uploadUrl =@"<Your host URL>";
[JSONHTTPClient postJSONFromURLWithString:uploadUrl params:nil
completion:^(NSDictionary *json, JSONModelError *err)
{
if(err == nil)
{
UIAlertView *alert=[[UIAlertView alloc]initWithTitle:@"success" message:@"uploaded" delegate:self cancelButtonTitle:nil otherButtonTitles:@"OK", nil];
[alert show];
completionHanldler(json);
}
else
{
UIAlertView *alert=[[UIAlertView alloc]initWithTitle:@"Failed" message:@"uploaded" delegate:self cancelButtonTitle:nil otherButtonTitles:@"OK", nil];
[alert show];
NSMutableDictionary *errorDict=[[NSMutableDictionary alloc]init];
if(err.code==-1009)
[errorDict setObject:@"The Internet connection appears to be offline."forKey:@"error"];
else
[errorDict setObject:@"Error occurred. Please try again!"forKey:@"error"];
completionHanldler(errorDict);
}
}];