Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to test if a file at an external URL exists without downloading it?
    primarykey
    data
    text
    <p>I would like to test if a URL exists without loading any actual data.</p> <p>I was thinking of initiating a NSURLConnection, and then using these two delegate methods to check the status:</p> <pre><code>- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error { // Connection failed ... presumably this is a server issue, and I don't know if the URL exists or not. } - (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response { int status = [((NSHTTPURLResponse *)response) statusCode]; [connection cancel]; // Do something with the status } </code></pre> <p>Would this be a sensible way? The files I'm testing could potentially be very large, so I want to make sure that the actual file is not downloaded.</p> <p>Thanks, Ron</p> <p>p.s. I'm looking at adding this because Apple forced my App to stop backing up files downloaded from the internet. Instead, I store the files in non-backed up space, and in my backed up database I keep track of the original location of the file. Since the file is intended to be a permanent part of the user's library, I would like to periodically test if a file is not accessible and then move it into backed up space (so it will survive a restore to a new device, for example). I'm very annoyed at Apple for forcing me to make this change as I can imagine customers losing important data.</p> <p>p.p.s. For some strange reason, these delegate methods no longer appear in the documentation for NSURLConnectionDelegate Protocol. I'm assuming the documentation is just messed up.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. COCan you elaborate on your statement, "Apple forced my App to stop backing up files downloaded from the internet." My app gives the user the option to save in iCloud a file downloaded from a server. Is Apple going to reject this option out of hand? What reason did they give for the rejection?
      singulars
    2. COI forget the exact wording, but Apple cited some new restriction that says that you can only backup files that are user created. It goes on to say that files that are re-creatable cannot be backed up and must have a "do not backup attribute". My problem is that the files my App downloads are only recreatable if the file on the web is not removed which my App has no control over. I'm not sure about files that are sent to iCloud ... my App was just storing files in my sandbox in an area other than Library/Caches.
      singulars
    3. COContinuing from my last comment- I contested the rejection, and got a call from Apple's developer department. They told me that they understand that my files are not recreatable, but that they still decided to reject my App. They even suggested that I use a 3rd party cloud solution like Dropbox to store the critical files that Apple won't allow me to have backed up. I'm trying to think about how to word this to the user of my App: "Apple will only allow this App to back up some of your critical files. If you want to backup all of them, please click on this link to set up a Dropbox account."
      singulars
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload