I have a TTTableView with a bunch of TTImageViews in it. The imageviews pull their images from a remote server. I can view all of the images in a browser just fine. They all load very quickly.
For some reason, about 10% of the TTImageViews time out when trying to load an image. The thing is, they time out really, really fast. Like under a second. When I load the TTTableView, I immediately get NSErrors like this (note: I’ve changed the server and image name):
Error Domain=NSURLErrorDomain Code=-1001 "The request timed out." UserInfo=0x84232f0 {NSErrorFailingURLStringKey=http://www.myserver.com/myimage.jpg, NSErrorFailingURLKey=http://www.myserver.com/myimage.jpg, NSLocalizedDescription=The request timed out., NSUnderlyingError=0x849e640 "The request timed out."}
So, any idea why the TTImageViews sporadically time out immediately?
I am not sure if this has something to do with that problem, but it sounds that could be related.
The problem I was having was that when 2 (or more) simultaneous requests to the same image URL occurred, the images wouldn’t load in any of the requests. And the error was always the same you reported:
I have found that in TTRequestLoader.m on the method
when there are 2 or more requests to the same URL, the code is:
So request variable results in “nil” value, and createNSURLRequest fails to set the timeout.
Modifying it to:
Seems to work OK
Hope this helps!