我正在使用Alamofire与API进行通信。网址是安全的,或者至少是Chrome所说的,但我还是会这样
The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.
网址为https://svinbra-api.herokuapp.com
从Heroku生成的认证是否足以在iOS应用中使用?
修改
错误消息告诉我,我正在尝试通过http而不是httpS进行连接。但我的代码做了不同的
class SCommunicator {
static var shared = SCommunicator()
private static var base_url = "https://svinbra-api.herokuapp.com/api/"
public func get(callback: (_ response: Response?) -> Void) {
// JUST TESTING CONNECTION
Alamofire.request(SCommunicator.base_url+"events").responseJSON { response in
print(response)
}
}
}
获取错误
NSErrorFailingURLStringKey=http://svinbra-api.herokuapp.com/api, NSErrorFailingURLKey=http://svinbra-api.herokuapp.com/api