I would like to get data from my server using the IPAdress. I did :
    let url = NSURL(string: "http://51.255.XX.XXX/")
    let task = NSURLSession.sharedSession().dataTaskWithURL(url!) {
        (data, response, error) in
        if error == nil {
            print(data)
        }
        else {
            print("error")
        }
and my output was :
 App Transport Security has blocked a cleartext HTTP (http://) 
 resource load since it is insecure. 
 Temporary exceptions can be configured via your app's Info.plist file.
I checked this error on internet and I did modify my info.plist like here : App Transport Security has blocked a cleartext HTTP resource. So I added the IP Adress as an exception like below :
<dict>
    <key>NSAllowsArbitraryLoads</key>
    <false/>
    <key>NSExceptionDomains</key>
    <dict>
        <key>http://51.255.XX.XXX/</key>
        <dict>
            <key>NSIncludesSubdomains</key>
            <true/>
            <key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
            <true/>
            <key>NSTemporaryExceptionMinimumTLSVersion</key>
            <string>TLSv1.1</string>
        </dict>
    </dict>
</dict>
My code works fine if I replace the IP Adress with a fully domain name (http://www.domain.com) but it doesn't when I put the server's IP Address instead of domain.com
My question is, is it possible to get data with NSURL using IP Adress ? If yes, do you have documentations or example to give me ?