I'm developing an IOS app, and I'm using my own created web services hosting in a windows server. I'm also using SSL certificate from RapidSSL.
I'm using UniRest Objective-C library, Unirest Lib >> and When I try to request https address, I'm getting this error.
Error Domain=NSURLErrorDomain Code=-1005 "The network connection was lost." UserInfo={NSUnderlyingError=0x1702501a0 {Error Domain=kCFErrorDomainCFNetwork Code=-1005 "The network connection was lost." UserInfo={NSErrorFailingURLStringKey=https://myapi.com/authorize.aspx, NSErrorFailingURLKey=https://myapi.com/authorize.aspx, _kCFStreamErrorCodeKey=54, _kCFStreamErrorDomainKey=1, NSLocalizedDescription=The network connection was lost.}}, NSErrorFailingURLStringKey=https://myapi.com/authorize.aspx, NSErrorFailingURLKey=https://myapi.com/authorize.aspx, _kCFStreamErrorDomainKey=1, _kCFStreamErrorCodeKey=54, NSLocalizedDescription=The network connection was lost.}
But If I request same adress with http protocol, There is no error!
Info.plist here;
I've just realized, Safari also can't open page! Weird!
I can open page on desktop Chrome and desktop Firefox but desktop Safari can't open too.
Here is my Code:
+(void)RunAuthApiWithUsername:(NSString *)username Password:(NSString *)password completion:(void (^)(BOOL success, NSString* title, NSString* message))completionBlock
{
NSDictionary* headers = @{@"accept": @"application/json"
};
NSDictionary *parameters = @{@"username": username,
@"password": password
};
[[UNIRest post:^(UNISimpleRequest *request) {
[request setUrl:API_AUTHORIZE_URL];
[request setHeaders:headers];
[request setParameters:parameters];
}] asJsonAsync:^(UNIHTTPJsonResponse* response, NSError *error) {
NSDictionary *jsonDict = response.body.JSONObject;
NSString* isSuccess = [jsonDict objectForKey:@"success"];
if([isSuccess isEqualToString:@"1"]){
completionBlock(YES, nil, nil);
}
else{
completionBlock(NO, [jsonDict objectForKey:@"title"], [jsonDict objectForKey:@"message"]);
}
}];
}