I'm working with SocketRocket, so far everything has been working fine and today I wanted to try to pin down a (self signed) certificate but I get an error:
- (void)connectWebSocket {
webSocket.delegate = nil;
webSocket = nil;
NSString *urlString = [NSString stringWithFormat: @"wss://%@:%@", server_ip, server_port];
//NSLog(@"%@", urlString);
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:urlString]
cachePolicy: NSURLRequestUseProtocolCachePolicy
timeoutInterval:5.0];
// pin down certificate
NSString *cerPath = [[NSBundle mainBundle] pathForResource:@"myOwnCertificate" ofType:@"cer"];
NSData *certData = [[NSData alloc] initWithContentsOfFile:cerPath];
CFDataRef certDataRef = (__bridge CFDataRef)certData;
SecCertificateRef certRef = SecCertificateCreateWithData(NULL, certDataRef);
id certificate = (__bridge id)certRef;
[request setSR_SSLPinnedCertificates:@[certificate]];
SRWebSocket *newWebSocket = [[SRWebSocket alloc] initWithURLRequest: request];
newWebSocket.delegate = self;
[newWebSocket open];
socketIsOpen = true;
}
Error: No visible @interface for 'NSURLRequest' declares the selector 'setSR_SSLPinnedCertificates:'
Am I missing something?
Thanks!