5
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

AFNetworking 2.6 で自己署名証明書(オレオレ証明書)SSLのhttps通信をする

5
Last updated at Posted at 2015-11-21

2年前のこちらの記事の時代からは少し状況が変わっているようです。
http://qiita.com/sintario/items/44ce2161dfdd17001796

AFHTTPRequestOperationManagerのプロパティsecurityPolicyallowInvalidCertificates = YESに加えてsecurityPolicy.validatesDomainName = NOの設定も必要なようです。

    AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
    manager.securityPolicy.allowInvalidCertificates = YES;
    manager.securityPolicy.validatesDomainName = NO;

ちなみに[AFHTTPRequestOperationManager manager]で取得したインスタンスでhttps通信できました。

ここの(公式?)Security Policyの情報だと
http://cocoadocs.org/docsets/AFNetworking/2.6.3/

AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
manager.securityPolicy.allowInvalidCertificates = YES; // not recommended for production

これだけで、できそうなのですが僕の環境ではこの設定だと通信エラーになりました。

こちらを参考にしました。
http://grandbig.github.io/blog/2015/10/02/afnetworking2-dot-6-0/

5
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?