Rostislav Borodin
Rostislav Borodin

Reputation: 53

SWIFT: 'SecPolicy' does not have a member named 'takeRetainedValue'

My Project had worked perfectly with SwiftHTTP in XCode 7 beta 3, before I've updated XCode 7 to beta 5.

Now I get the error: 'SecPolicy' does not have a member named 'takeRetainedValue'.

var policy: SecPolicyRef
    if self.validatedDN {
        policy = SecPolicyCreateSSL(1, domain).takeRetainedValue()
    } else {
        policy = SecPolicyCreateBasicX509().takeRetainedValue()
    }

Is there any oppotunity to fix it?

Thanks!

Upvotes: 3

Views: 666

Answers (1)

Stuart
Stuart

Reputation: 37053

As of iOS 9, the Security framework returns values that are automatically memory managed, as opposed to being Unmanaged references. As such, you no longer need to call takeRetainedValue() (indeed, you can't, since they're no longer returning Unmanaged values), so just delete those calls and the system will release them automatically when needed.

For more info on unmanaged Core Foundation references, see this section in the Using Swift with Cocoa and Objective-C guide.

Upvotes: 4

Related Questions