I wrote a program that can download an updated data file publicly available from the US Government's FCC website. The file is updated weekly. This week, I went to download the file with my program and it failed to download. I looked at the HTTPURLResponse parameter to the completion callback and it shows a statusCode of 403 (forbidden). The program is the same program as last week when it worked. I copied the exact URL that the program was trying to download to both Safari and the command line curl and both were able to download the file without issue on the same computer. I changed the program to try and download a different file from a different server and it downloaded fine.
I tried running the same program on a different Mac and it failed also.
I tried several times for over an hour with the same result.
Browsing the web for a solution I see mention of clearing caches. How does one clear the caches for a SwiftUI program?
Thanks, Mark
I think I figured it out. URLSession uses a user agent of the application bundle name / build. Somehow the build setting on my program was cleared so the user agent was / (Unknown version number). That was causing the FCC's server to reject my request. I change the build number in Xcode and I can download my file.