IOS when the terminal requests the server data, in order to ensure the data security, we generally use HTTPS protocol encryption, and for IOS network programming, we typically use an open source framework: ASIHTTPRequest , but if you use a traditional http even if the validation is ignored, the program will report [error-9844] error, the specific error is described below:
" Error domain=asihttprequesterrordomain code=1 "A connection failure occurred" Userinfo=0x6aafa30 { Nsunderlyingerror=0x6a3fd90 "The operation couldn ' t be completed. (Osstatus error-9844.) ", Nslocalizeddescription=a connection failure occurred}"
So how do you solve the problem? Find the following solutions:
Solution Solutions 1
1) [Request Setvalidatessecurecertificate:no];
2) Find "https" in the asihttprequest.m file and add Kcfstreamssllevel object to the Sslproperties dictionary, the reference method on the Internet:
[Sslproperties setobject: (NSString *) (cfstringref*) KCFStreamSocketSecurityLevelSSLv3 Forkey: (nsstring*) kcfstreamssllevel];
However, the Sslproperties dictionary is not a mutable dictionary, so you need to change sslproperties to a mutable dictionary nsmutabledictionary.
Solution Solutions 2
If you need more flexibility to set the SSL security level, you can refer to Cfstringref*sslsecuritylevel as a variable in the property of the ASIHTTPRequest.h file, as follows:
1) Add a statement in the ASIHTTPRequest.h file:
Cfstringref *sslsecuritylevel;
2) Add the Cfstringref attribute to the ASIHTTPRequest.h file:
@property (assign) Cfstringref *sslsecuritylevel;
3) Add the Cfstringref attribute to the ASIHTTPREQUEST.M file:
@synthesize Sslsecuritylevel;
4) Modification of files in ASIHTTPREQUEST.M:
Nsdictionary *sslproperties = [[Nsdictionary alloc]initwithobjectsandkeys:??, change the immutable dictionary to a mutable dictionary (nsmutabledictionary), i.e.:
Nsmutabledictionary *sslproperties = [[Nsmutabledictionary alloc]initwithobjectsandkeys:??
5) Add the code that sets the SSL security level at the end of the 4 edit statement:
Use requested SSL security level
if ([self sslsecuritylevel]! = nil) {
[Sslproperties setobject: (NSString *) [Self Sslsecuritylevel] Forkey: (NSString *) kcfstreamssllevel];
}
6) Make the following settings in the call request:
[Request Setvalidatessecurecertificate:no];
[Request Setsslsecuritylevel: (cfstringref*) kCFStreamSocketSecurityLevelSSLv3];