Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSL Pinning NSURLErrorDomain Code=-999 #37

Open
mrhaxic opened this issue Jun 12, 2017 · 0 comments
Open

SSL Pinning NSURLErrorDomain Code=-999 #37

mrhaxic opened this issue Jun 12, 2017 · 0 comments

Comments

@mrhaxic
Copy link

mrhaxic commented Jun 12, 2017

Hi, I added crt file into bundles and used this code

NSString *certPath = [[NSBundle bundleForClass:[self class]] pathForResource:@"PushCrt" ofType:@"crt"];
  NSData *certData = [NSData dataWithContentsOfFile:certPath];
  [XMCenter addSSLPinningCert:certData];
  [XMCenter addSSLPinningURL:@"https://*****.net"];
  
  
  [XMCenter sendRequest:^(XMRequest *request) {
      request.url = [NSString stringWithFormat:@"https://*****:8801/api/v2/tokens"];
      request.parameters = @{@"device": @"ios", @"token" : @"aa", @"channel" : @"default"};
      request.httpMethod = kXMHTTPMethodPOST;
      request.headers = @{@"X-AN-APP-NAME" : @"**", @"X-AN-APP-KEY" : @"**"};
      //request.responseSerializerType = kXMResponseSerializerJSON;
  } onSuccess:^(id responseObject) {

      NSLog(@"%@",responseObject);
      
  } onFailure:^(NSError *error) {
      
      NSLog(@"%@",error);
      NSLog(@"%@",[error localizedFailureReason]);
      
  } onFinished:^(id responseObject, NSError *error) {
      
  }];

but it exception by below error, any hint?

Error Domain=NSURLErrorDomain Code=-999 "cancelled" UserInfo={NSErrorFailingURLKey=https://*:8801/api/v2/tokens, NSLocalizedDescription=cancelled, NSErrorFailingURLStringKey=https://:8801/api/v2/tokens}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant