Alamofire: Use Xcode 8 to open the project as the following error:"Use of unresolved identifier 'kSecTrustResultInvalid' "

Created on 15 Sep 2016  ·  4Comments  ·  Source: Alamofire/Alamofire

fd774a26-2c00-4b13-b3ba-711a64bc47d2
Alamofire/Source/ServerTrustPolicy.swift:243:41: Use of unresolved identifier 'kSecTrustResultInvalid'

support

Most helpful comment

Try Below Code. This worked for me. You've to capitalised enum type for swift 2.3 and Smaller for 3.0

var result = SecTrustResultType.Invalid
let status = SecTrustEvaluate(trust, &result)

if status == errSecSuccess {
       let unspecified = SecTrustResultType.Unspecified
       let proceed = SecTrustResultType.Proceed


       isValid = result == unspecified || result == proceed
}

return isValid

All 4 comments

Update your library,

updated now and in ServerTrustPolicy file i can see:

`
private func trustIsValid(_ trust: SecTrust) -> Bool {
var isValid = false

    var result = SecTrustResultType.invalid
    let status = SecTrustEvaluate(trust, &result)

    if status == errSecSuccess {
        let unspecified = SecTrustResultType.unspecified
        let proceed = SecTrustResultType.proceed


        isValid = result == unspecified || result == proceed
    }

    return isValid
}

`

Please ensure you are using the appropriate version of Xcode for the version of Alamofire you're trying to use. Alamofire 4 requires Xcode 8, Alamofire 3.5 is compatible with both Xcode 7.3 and Xcode 8 with the "Use legacy Swift version" setting set to true.

I am using Appropriate version. I tried Alamofire 3.1.4, 3.5.0, 3.5.1 with Xcode 8. Use Legacy swift version = YES. Still unresolved identifier error is appearing !
Any other solution ?

Try Below Code. This worked for me. You've to capitalised enum type for swift 2.3 and Smaller for 3.0

var result = SecTrustResultType.Invalid
let status = SecTrustEvaluate(trust, &result)

if status == errSecSuccess {
       let unspecified = SecTrustResultType.Unspecified
       let proceed = SecTrustResultType.Proceed


       isValid = result == unspecified || result == proceed
}

return isValid
Was this page helpful?
0 / 5 - 0 ratings

Related issues

sarbogast picture sarbogast  ·  3Comments

shivang2902 picture shivang2902  ·  3Comments

Footjy picture Footjy  ·  3Comments

noear picture noear  ·  3Comments

solomon23 picture solomon23  ·  3Comments