我有 3 个baseURL
,这 3 个有不同的 ssl 证书,我已经下载了一个证书并在 Xcode 项目中硬编码,即使我更改了url
请求,应用程序不会阻止请求。
我正在使用这个类
class APIManager {
static let sharedInstance = APIManager()
private var manager : SessionManager?
func sessionManager() -> SessionManager {
if let manage = self.manager {
return manage
}
else {
let serverTrustpolicies: [ String: ServerTrustPolicy] = ["url" : .pinPublicKeys(publicKeys: ServerTrustPolicy.publicKeys(), validateCertificateChain: true, validateHost: true)
]
self.manager = SessionManager(
serverTrustPolicyManager: ServerTrustPolicyManager(policies: serverTrustpolicies)
)
let configuration = URLSessionConfiguration.default
configuration.timeoutIntervalForRequest = 30
self.manager = SessionManager(configuration: configuration)
return self.manager!
}
}
}
APIManager.sharedInstance.sessionManager().upload(multipartFormData: { (multipartFormData)
}
任何人都可以解释实施吗?