Ho chiamato il servizio Web dalla mia app ios utilizzando NSURLConnection. Ecco il mio codiceOttieni dominio errore = NSURLErrorDomain Code = -1004 "Impossibile connettersi al server."
#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);
}
sua fine per chiamare questo URL http://winshark.softwaytechnologies.com/bariodwcfservice/baroidservice.svc/Json/Products/123
ma quando ho colpito questo URL sul browser il suo bel lavoro, ma nella mia app im ottenere questo errore
Error Domain=NSURLErrorDomain Code=-1004 "Could not connect to the server."
prega aiutami quale potrebbe essere il problema
Lo stai testando sul dispositivo o sul simulatore? – Wasim
è non funzionante – sachin