Tristan
Tristan

Reputation: 3068

Rules about including 3rd party libraries in frameworks

I'm currently working on a framework for interfacing with a web service I wrote. To make life easier, I'm considering using a wrapper around CFNetwork, called ASIHTTPRequest.

That's all wonderful. But what happens if the user already added that class to their project? I'm sure the linker would throw up an error. Is there any way to 'constrain' classes to only exist in a specific framework, so the linker will ignore them outside of that framework/library? Alternatively, I can always use plain CFNetwork APIs, but that's just a pain and as we all know, programmers are lazy =P

Thanks for any ideas/suggestions.

Upvotes: 0

Views: 68

Answers (1)

Lily Ballard
Lily Ballard

Reputation: 185681

No. There is absolutely no way to do this. You won't get a linker error if you do, but you'll get a runtime warning printed by dyld directly to the console on every single launch, and if the version of ASIHTTPRequest that you bundle differs in any meaningful way from the version the application uses, then you could get bad behavior or a crash.

HTTP really isn't that hard. Why would you use CFNetwork? Just use NSURLConnection.

Upvotes: 1

Related Questions