我有一个项目,我使用了AFNetworking 2.0(不是可可豆荚-只是添加到了项目中)
I have a project, where Ive used AFNetworking 2.0(not as cocoa pod - just added to project)
然后,我实现了日历MSCollectionViewCalendarLayout,封装在pod中的依赖项很少,其中一个是//'RestKit','〜> 0.22.0'//。 RestKit使用AFNetowrking 1.3,并将其打包在RestKit中。
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.
在使用日历时,我禁用了最初的AFNetworking 2.0代码,但是现在,当我微调日历时,我没有为Login auth(AFNetworking 2.0)添加注释代码,并且它停止了工作:
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序列化器]; <-说没有这种属性。
operation.responseSerializer = [AFXMLParserResponseSerializer serializer]; <-- saying there is no such property.
两个AFNetworking库是否可以在同一个项目中共存?考虑到RestKit不能与AF 2.0一起使用,解决此问题的最佳方法是什么?
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?
非常感谢
推荐答案如果要使用AFNetworking 2.x类,则需要导入AFNetworking 2.x标头,而如果要使用1.x标头,则需要导入1.x标头。
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.
您还可以尝试 RestKit的实验版本,支持AFNetworking 2 ,甚至对其开发有所贡献。
You could also try the experimental version of RestKit that supports AFNetworking 2, or even contribute to its development.
更多推荐
在同一ios项目中使用2个版本的AFNetworking
发布评论