मैं शोकहारा सेवा है जो त्रुटि देता हैiphone: सुरक्षित restfull सर्वर इस सर्वर के लिए प्रमाणपत्र अमान्य है "इस सर्वर के लिए प्रमाणपत्र अमान्य
त्रुटि = त्रुटि सुरक्षित डोमेन = NSURLErrorDomain कोड = -1202 का उपभोग करने के कोशिश कर रहा हूँ कि" । आप "xxx.xxx.xxx.xxx" होने का नाटक कर रहे सर्वर से कनेक्ट हो रहे हैं जो आपकी गोपनीय जानकारी को जोखिम में डाल सकता है। "
xCode 4.2 पर काम कर रहा है, गलती या कोई चरण गुम है।
कोड
RegisterUser.f
@interface RegisterUser : UIViewController<UITextFieldDelegate,
UIScrollViewDelegate, NSURLConnectionDelegate>
RegisterUser.m
- (IBAction)SubmitBtnAction:(id)sender {
NSURL *url = [NSURL URLWithString:@"https://xx.xx.xx.xxx:8223/jaxrs/tunedoorgateway/getCountries"];
NSURLRequest *urlRequest = [NSURLRequest requestWithURL:url];
[NSURLConnection sendAsynchronousRequest:urlRequest queue:[[NSOperationQueue alloc] init]
completionHandler:^(NSURLResponse *response, NSData *data, NSError *error)
{
if ([data length] >0 && error == nil)
{
NSLog(@"Data = %@", data);
// DO YOUR WORK HERE
}
else if ([data length] == 0 && error == nil)
{
NSLog(@"Nothing was downloaded.");
}
else if (error != nil){
NSLog(@"Error = %@", error);
}
}];
}
- (BOOL)connection:(NSURLConnection *)connection canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace *)protectionSpace {
NSLog(@"This is canAuthenticateAgainstProtectionSpace");
return [protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust];
}
- (void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
{
// if ([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust])
// if ([trustedHosts containsObject:challenge.protectionSpace.host])
[challenge.sender useCredential:[NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust] forAuthenticationChallenge:challenge];
[challenge.sender continueWithoutCredentialForAuthenticationChallenge:challenge];
NSLog(@"This is didReceiveAuthenticationChallenge");
// [[challenge sender] cancelAuthenticationChallenge:challenge];
}
निम्नलिखित का उपयोग कर
मैं अपने डिवाइस के लिए उचित तिथि और समय निर्धारित करके इसे हल कर दूंगा। – Hemang
स्वचालित रूप से डिवाइस की दिनांक और समय को सेट करने के साथ ही एक ही समस्या हल करें। –