NSURLCredential cant compile in Swift -


I have some compilation problems with the latest XCode 6.1 (6A1046a)

this line will be compiled:

  var newCredential = NSURLCredential (user: "test", password: "test", firmly NSURLCredentialPersistence.None);   

But it throws an "extra logic" identity into the call:

  var identity: SecIdentity = self.getClientCertificate (); Var newCredential2 = NSURLCredential (Identity: Identity, Certificate: Zero, Persistence: NSURLCredentialPersistence.None);   

But I do not know why it should work according to the manual:

Any thoughts?

Error swift that you are misleading (a common issue if a function is incorrectly Is one of the passing arguments). The problem is that the certificate is defined as [AnyObject] , but you are passing it to zero . Since certificate is not an option, it can not take any zero value. The documentation also says:

One or more of the certificate for identity certificates of SecCertificateRef object.

So, you must pass an array of at least one certificate to it.

Comments