Repository navigation
Conversation
|
I'm gonna close this for now as I've incorporated it into a new branch over at #38. |
* define constant error domain * cleanup some comments * avoid early return * valid HTTP responses should already check for status 200
|
I made some changes in the above commit f7c3b73 and associated branch
Thoughts? |
|
Hmm... be careful with that. Looking at your commit, I don't think that's gonna work. I tested that stuff pretty thoroughly to account for a number of edge cases (see comments). For instance, have you tested what your modified code does if the response is an HTTP 404 or a 500?
The critical thing is that
Maybe I'm confused, but I'm pretty sure it doesn't work like that. If the HTTP request completes in any fashion, you get an NSHTTPURLResponse, and you have to check the statusCode and make your own decisions about which ones are acceptable. My intent with
I tried to mimic your style as best I could. Please edit away and I'll keep your changes in mind for later. |
|
Cool, not doubting your original code, just discussing via alternate code. I will do some poking then on my stuff. |
|
Cool. Also, in case you didn't notice my edit above about |
|
You got me wondering about all this... I made a little test app to explore the permutations of Running that with a network connection yields this log: ... and running it in airplane mode does this: That summarizes to...
|
|
To me that looks like your intuition about something being redundant was correct, but it was actually the airplane mode stuff which was the problem. Now I'm of the opinion that the logic should flow like this: |
|
If, in airplane mode, the data was coming up empty and an error was registering, then how would it have been getting cached to disk? The current release would have skipped over it. |
|
Ah, I think I see. Need to test, but I think airplane mode gives a zero length but otherwise valid data. |
|
Correct. For anything that I've tested in this context, Line 199 in a6b37f6 |
|
Cool. I am going to rework my branch a bit based on these tests, then post back about it here and we can discuss some more, then merge. |
I think I was misremembering something here related instead to old
|
|
I just pushed b28f574 to my branch, which incorporates what we've talked about around the three conditions. On the Could you give the branch a swing @wsnook and let me know what you think? |
Reading through that, it looks good. I haven't tried compiling or testing it though. There's one issue with casting b28f574#commitcomment-5477699 which could be handled by returning another custom NSError if If you want me to test your branch, I can do that, but my inclination would be to just merge this, then do some thorough testing across the board once you're finished merging, then patch as needed to get it into shape for a release. |
Agree here 👍 I will get this guy merged this morning. |
|
4b7ee29 also fixes the edge case you mention above about non-HTTP responses. |
This addresses issue #22 where empty PNG files were getting written to cache for tiles which failed to load while the app was running in airplane mode. There are two parts to the change:
loadTileAtPath:result:now takes a closer look at the type of response generated by the tile request. Anything other than an HTTP 200 is treated as an error (i.e. don't write file to cache, callresult(data,error)with nil data and an NSError describing the problem).loadTileAtPath:result:code.