AFNetWorking与Https

来源:互联网 发布:濒死 知乎 编辑:程序博客网 时间:2024/06/11 06:17

第一步,导入AFNetWorking 库

第二步,在pch文件中加入

[objc] view plaincopy在CODE上查看代码片派生到我的代码片
  1. #import <SystemConfiguration/SystemConfiguration.h>  
  2. #import <MobileCoreServices/MobileCoreServices.h>  
  3. #define AFNETWORKING_ALLOW_INVALID_SSL_CERTIFICATES  


第三步:

[objc] view plaincopy在CODE上查看代码片派生到我的代码片
  1. - (void)inithttps{  
  2.     AFSecurityPolicy *securityPolicy = [AFSecurityPolicy defaultPolicy];  
  3.     securityPolicy.allowInvalidCertificates = YES;  
  4.     [AFHTTPRequestOperationManager manager].securityPolicy = securityPolicy;}  

0 0
原创粉丝点击