मैं NSRLConnection का उपयोग कर अपने आईओएस ऐप से वेब सेवा बुला रहा हूं। यहाँ मेरी कोड हैत्रुटि प्राप्त करना डोमेन = NSURLErrorDomain कोड = -1004 "सर्वर से कनेक्ट नहीं हो सका।"
#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);
}
इसका अंत इस यूआरएल http://winshark.softwaytechnologies.com/bariodwcfservice/baroidservice.svc/Json/Products/123
बुला लेकिन जब मैं ब्राउज़र में इस URL मारा इसके ठीक काम कर रहा है, लेकिन मेरे ऐप im में इस त्रुटि
Error Domain=NSURLErrorDomain Code=-1004 "Could not connect to the server."
कृपया हो रही मेरी मदद करें समस्या क्या हो सकती है
क्या आप डिवाइस या सिम्युलेटर पर इसका परीक्षण कर रहे हैं? – Wasim
यह काम नहीं कर रहा है – sachin