如果需要更加灵活的对SSL security level进行设置,可以将CFStringRef*sslSecurityLevel作为变量提到ASIHTTPRequest.h文件的property中,具体操作如下: 1) 在ASIHTTPRequest.h的文件中添加声明: CFStringRef *sslSecurityLevel; 2) 在ASIHTTPRequest.h的文件中添加CFStringRef属性: @property (assign) CFStringRef *sslSecurityLevel; 3) 在ASIHTTPRequest.m的文件中添加CFStringRef属性: @synthesize sslSecurityLevel; 4) 在ASIHTTPRequest.m的文件修改: NSDictionary *sslProperties = [[NSDictionary alloc]initWithObjectsAndKeys:??,将不可变字典更改为可变字典(NSMutableDictionary),即: NSMutableDictionary *sslProperties = [[NSMutableDictionary alloc]initWithObjectsAndKeys:?? 5) 在4)修改语句结束的地方添加设置SSL security level的代码: // Use requested SSL security level if ([self sslSecurityLevel] != nil) { [sslProperties setObject:(NSString *)[self sslSecurityLevel] forKey:(NSString *)kCFStreamSSLLevel]; } 6) 在调用请求的request中做如下设置: [request setValidatesSecureCertificate:NO]; [request setSslSecurityLevel:(CFStringRef*)kCFStreamSocketSecurityLevelSSLv3]; 转自:http://mmz06.blog.163.com/blog/static/12141696201211752931454/ |