Does anyone have an example of using the CBLReplication setAnchorCert method in Swift they could share?
Swift + setAnchorCert example?
Does anyone have an example of using the CBLReplication setAnchorCert method in Swift they could share?
Swift + setAnchorCert example?
Is that a no?
No - examples?
No - not in Swift?
Anyone? Anyone?
Okay. So I’m answering my own question so as to help others.
Tricks.
der
format, and stored in your project bundle.This code is “base code” - you’ll need to add error checking etc.
let certificateFileName = "data" let certificatePath = NSBundle.mainBundle().pathForResource(certificateFileName, ofType: "der") let certificateData = NSData(contentsOfFile: certificatePath!) let certificate = SecCertificateCreateWithData(nil, certificateData!) CBLReplication.setAnchorCerts([certificate as! AnyObject], onlyThese: true)