llamo al servicio web desde mi aplicación ios usando NSURLConnection. Aquí está mi códigoObteniendo dominio de error = NSURLErrorDomain Code = -1004 "No se pudo conectar con el servidor".
#define kBaseServerUrl @"http://winshark.softwaytechnologies.com/bariodwcfservice/baroidservice.svc/Json/"
#define kProductServiceUrl @"Products"
-(void)callService{
NSURL *url;
if (currState == ProductServiceState) {
url = [NSURL URLWithString:[NSString stringWithFormat:@"%@%@/%d",kBaseServerUrl,kProductServiceUrl,[self getRevisionNumberForProduct]]];
}
else if(currState == TankStrickerServiceState){
url = [NSURL URLWithString:[NSString stringWithFormat:@"%@%@/%d",kBaseServerUrl,kTankStrickerServiceUrl,[self getRevisionNumberForTankStricker]]];
}else if(currState == CalculationServiceState){
url = [NSURL URLWithString:[NSString stringWithFormat:@"%@%@/%d",kBaseServerUrl,kCalculationServiceUrl,[self getRevisionNumberForCalculation]]];
}else{
//Future Use
}
NSLog(@"%@",[url absoluteString]);
NSURLRequest *urlRequest = [NSURLRequest requestWithURL:url];
NSURLConnection *urlConnection = [[NSURLConnection alloc] initWithRequest:urlRequest delegate:self];
NSLog(@"%@",urlConnection);
}
Su acabar llamando a esta url http://winshark.softwaytechnologies.com/bariodwcfservice/baroidservice.svc/Json/Products/123
pero cuando golpeo esta URL en el navegador de su trabajo bien, pero en mi aplicación im conseguir este error
Error Domain=NSURLErrorDomain Code=-1004 "Could not connect to the server."
favor ayúdeme lo que podría ser un problema
¿Está probando esto en el dispositivo o en el simulador? – Wasim
ambos no funcionan – sachin