I recently added pod 'Alamofire', '~> 5.4.0'
to my project but in ServerTrustEvaluation.swift line 603 there is an error:
return SecTrustCopyKey(createdTrust) //'SecTrustCopyKey' is only available in iOS 14.0 or newer
how can I fix this? should is use earlier version?
You could wrap that code in an #available
-statement like so:
if #available(iOS 14, *)
{
return SecTrustCopyKey(createdTrust)
}
else
{
// Return something else here.
}
Obviously that means you won't be able to use SecTrustCopyKey()
on devices running a lower iOS version. Finding an equivalent for that function, which works for previous iOS versions, would be a solution. That can be used in the else { ... }
.
您可以将部署目标更改为 14 ,如果不需要支持旧版本的 IOS
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.