0

Good morning, in my app I would like to download some data from a url. I am using the following code, passing the first "url" as a string:

guard let url = URL(string: url) else {
            print("Invalid URL")
            return
        }

When using it in simulator, all works fine; on the contrary, in real device (iPhone 7, 14.5.1) within the app the same url is considered invalid. Pasting it in Safari, the url is correctly recognized. Any suggestion would be really appreciated, thank you

lorem ipsum
  • 21,175
  • 5
  • 24
  • 48
Phalaen
  • 61
  • 1
  • 8
  • maybe it is to do with the permissions. Is the url https or http? – workingdog support Ukraine May 28 '21 at 07:35
  • 1
    Without a [Minimal Reproducible Example](https://stackoverflow.com/help/minimal-reproducible-example) it is impossible to help you troubleshoot. – lorem ipsum May 28 '21 at 10:03
  • Thank you, the url is " https:// " type: should I ask for specific permissions? I am sure that the problem is specifically in that part of the code, unfortunately I can not write the specific url publicly. – Phalaen May 28 '21 at 14:34
  • Trying with the code suggested here https://stackoverflow.com/a/35049463/3876763 it returns true (verified url) in simulator and false in the real device – Phalaen May 28 '21 at 16:28

0 Answers0