Afnetwork This library, is now the use of comparison of the library, we do instant communication, will also join the library, use up or relatively cool.
Sometimes we will use HTTPS, in the Afnetwork this library, in fact, has very good encapsulation of HTTPS, yes, we can easily use.
First step, import the Afnetworking library
The second step is to include in the PCH file
[OBJC]View Plaincopy
- #import <SystemConfiguration/SystemConfiguration.h>
- #import <MobileCoreServices/MobileCoreServices.h>
- #define Afnetworking_allow_invalid_ssl_certificates
Step Three:
[OBJC]View Plaincopy
- -(void) inithttps{
- afsecuritypolicy *securitypolicy = [Afsecuritypolicy defaultpolicy];
- SecurityPolicy. allowinvalidcertificates = YES;
- [Afhttprequestoperationmanager Manager]. securitypolicy = securitypolicy;}
This allows you to use afnetworking for HTTPS operations in your program.
Afnetwork Request HTTPS