Category methods collision #859

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
6 participants

dmishe commented Mar 21, 2013

Hey, there was an interesting issue on RestKit project RestKit/RestKit#1285

Looks like AFNetworking UIImageView category shares some method names with that of SDWebImage, which leads to weird bugs as seen above.

https://github.com/rs/SDWebImage/blob/master/SDWebImage/UIImageView%2BWebCache.h#L53
https://github.com/AFNetworking/AFNetworking/blob/master/AFNetworking/UIImageView%2BAFNetworking.h#L43

I wonder if there should be a af_ prefix, I understand that this will lead to big backwards compatibility breakage :/

/cc @rs

Contributor

blakewatters commented Mar 18, 2013

A simple, lightweight solution for this in the context of a CocoaPods based install would be to move the UIImageView category into a subspec so that it can be installed optionally.

Contributor

AquaGeek commented Mar 19, 2013

Backwards compatibility breakage or not, category methods should be prefixed to prevent this exact situation.

According to #822 there are additional UIKit categories going in to 2.0, so perhaps that would be an appropriate point to split into a subspec covering all UI.

sadface

Owner

dmishe replied Mar 22, 2013

Why so sad?

Contributor

kcharwood commented Apr 7, 2013

sadface because of 1) that there is a collision, 2) the prefix naming is ugly to me, and 3) the api breakage you mentioned...

Sadfaces all around.

Contributor

mattt commented Apr 7, 2013

AFNetworking 2.0 will split the UIImageView category, along with other UIKit components into its own extension. This will obviate the need for an API change. For now, I will close this issue as "WontFix", though.

mattt closed this Apr 7, 2013

Contributor

mattt commented Apr 7, 2013

Of course, another solution would become strictly better than SDWebImage, making the situation moot ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment