using 2 versions of AFNetworking in same ios project

旧街凉风 提交于 2019-12-11 03:23:44

问题


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


回答1:


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.



来源:https://stackoverflow.com/questions/27698872/using-2-versions-of-afnetworking-in-same-ios-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!