Swift,如何从 RestKit 获得响应 headers?

Swift, how can I get response headers from RestKit?

我有一个 RestKit 请求如下。如何从响应中获取身份验证令牌 headers?

    RKObjectManager.shared()
        .getObjectsAtPath(urlString,
                      parameters: paramsDictionary,
             success: {(operation: RKObjectRequestOperation?, result: RKMappingResult?) -> Void in



pod 'RestKit', '~> 0.27.0'

你可以像这样从RKObjectRequestOperation获取响应头。

if let operation = operation, let headers = operation.httpRequestOperation.response.allHeaderFields as? [String:Any] {
    print(headers)// Now use subscript with headers dictionary to get your token value
}