(Optional) For a HTTP(S) protocol, when a client attempts to setup a trusted connection with the host (like a relay server), the host responds with a certificate. To verify if the server certificate is trusted or not, the application registers a delegate with the OData SDK. If the server certificate is trusted, the connection is successful. If the server certificate is not trusted, the delegate determines if the certificate should be deemed trusted and proceed with the connection.If no delegate is set, all certificate chains that are not automatically trusted are rejected.
To register a listener for certificate verification, implement the protocol ODPCertificateChallengeListenerDelegate
@protocol ODPCertificateChallengeListenerDelegate <NSObject> @required -(void) onCertificateChallenge:(NSString*) certInfo; @end
-(void) onCertificateChallenge:(NSString*)certInfo { NSLog(@"%@", certInfo); [ODPClientListeners certificateChallengeResult:NO]; } -(IBAction)httpsCheck:(UIButton*)button { @try { ODPUserManager* manager = [ODPUserManager getInstance:@"NewFlight"]; [ODPClientListeners setCertificateChallengeListenerDelegate:self]; [ODPUserManager enableHTTPS:YES]; [manager setConnectionProfile:@<host> withSupPort:<port> withServerFarmID:@<farmID>]; [manager registerUser:@<supuser> withSecurityConfig:@<securityconfig> withPassword:@<password>]; } @catch (NSException *exception) { NSLog(@"%@", [exception callStackSymbols]); NSLog(@"%@", [[exception userInfo] objectForKey:@"ErrorCode"]); } }