Search code examples
afnetworkingrestkit

using 2 versions of AFNetworking in same ios project


I have a project, where Ive used AFNetworking 2.0(not as cocoa pod - just added to project)

Then, I've implemented calendar MSCollectionViewCalendarLayout, which has few dependencies packaged in a pod, one of which is // 'RestKit', '~> 0.22.0' //. RestKit uses AFNetowrking 1.3 and has it packaged within RestKit.

While working with calendar, I have disabled my initial AFNetworking 2.0 code, but now when i fine tuned the calendar, Ive uncommented code for Login auth(AFNetworking 2.0), and it stopped working:

operation.responseSerializer = [AFXMLParserResponseSerializer serializer]; <-- saying there is no such property.

Is it possible for both AFNetworking libs to co-exist in the same project? What would be the best way to resolve this considering that RestKit does not work with AF 2.0?

Many thanks


Solution

  • You'll need to import the AFNetworking 2.x headers when you want to use AFNetworking 2.x classes, and the 1.x headers when you want to use those.

    If you have one class that needs both, you'll need to split the functionality of that class into two separate classes. You could also use a dynamic messaging hack to resolve the conflict, but that would probably get icky.

    You could also try the experimental version of RestKit that supports AFNetworking 2, or even contribute to its development.