2

I'm using Alamofire to communicate with an API. The url is secure, or at least what Chrome says, but I'm still getting The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.

The url is https://svinbra-api.herokuapp.com

Is the certificated generated from Heroku to weak to be used in an iOS app?

EDIT

The error message tells me that I'm trying to connect through http and not httpS. But my code does different

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)
        }
    }
}

Getting error

NSErrorFailingURLStringKey=http://svinbra-api.herokuapp.com/api, NSErrorFailingURLKey=http://svinbra-api.herokuapp.com/api

Rikard Olsson
  • 841
  • 1
  • 7
  • 28
  • http://stackoverflow.com/questions/32631184/the-resource-could-not-be-loaded-because-the-app-transport-security-policy-requi check out this solution – tennis779 Feb 24 '17 at 19:16
  • I've tried that solution and still getting the same error... Although, the question still remains why I can't connect to a secure site – Rikard Olsson Feb 24 '17 at 20:12
  • Have you tried connecting to another arbitrary url that is also HTTPS to see if that succeeds. This could prove that it's not it's not an issue with the url you are trying to request. – tennis779 Feb 24 '17 at 20:37
  • @tennis779 Great question, thanks. I did try som random https-website (happen to be https://www.data.gov, which seem pretty legit) and yeah, it works.. So probably the certificate from Heroku isn't good enough – Rikard Olsson Feb 24 '17 at 21:40
  • @Rikard Olsson, when I try the url: "https://svinbra-api.herokuapp.com/api/" in firefox, it redirects me to: "http://svinbra-api.herokuapp.com/api". The 2nd site isn't secure, like the error reports. – Larry B Feb 24 '17 at 23:11
  • @LarryB Oh, okey! That's strange.. Thank you for that info, I'll check that up! – Rikard Olsson Feb 25 '17 at 11:26

0 Answers0