Skip to content


Subversion checkout URL

You can clone with
Download ZIP


RKHTTPRequestOperation Error when fetching images with SDWebImage (-999 cancelled) #1285

sprynmr opened this Issue · 6 comments

3 participants


So I'm not sure if this is a bug with RestKit, SDWebImage, or I'm somehow doing something very wrong. I have a table view loading in images to cells via the UIImageView+WebCache category. I keep getting this error, and I'm unsure why RestKit is even in the mix in this situation:

E GET '' (0) [0.0394 s]: Error Domain=NSURLErrorDomain Code=-999 "The operation couldn’t be completed. (NSURLErrorDomain error -999.)" UserInfo=0x12a99620 {NSErrorFailingURLKey=}

Why is SDWebImage going through RKHTTPRequestOperation somehow? Then of course, why is it canceling the download?

If you think this is actually a restkit issue, let me know if you need more data.



[self.thumbnailImageView setImageWithURL:[NSURL URLWithString:object.imageUrl]];

Where object.imageUrl is obviously the url I'm seeing in the error logs. Not specific to one image, or even one image source (yelp cdn vs google images).


Ok, so AFNetworking (which is part of RestKit) has the same category methods as SDWebImage defined on UIImageView. Therefore, it's unknown which one will be called, in your case AFNetworking clearly wins.

Now, RKHTTPRequestOperation subscribes to NSNotification from AFNetworking operations, which is why you're seeing this log message.

This analysis could be too shallow, but I'm sure the problem arises from colliding categories.
I do not know of a way to resolve such a collision (maybe exclude UIImageView+AFNetworking from imports somehow), so I would recommend to replicate what setImageWithURL does in your own code.


I can't close the issue :)
It's an interesting one though for sure, I wonder if passing object:nil here

could lead to more subtle bugs, @blakewatters ?

@dmishe dmishe referenced this issue in AFNetworking/AFNetworking

Category methods collision #859


@dmishe The line you are referencing is in the RKHTTPRequestOperationLogger class, which observes all AFNetworking operations started within the application and emits logging information. That object:nil argument just tells the observation center that we want to watch any networking, rather than ones emitted by a particular objects.

This definitely is a conflict between AFN and SDWebImage. My recommendation would be to split the UIImage category into a subspec that would allow users to opt-in to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.