从RestKit转换到纯AFNetworking 2.0 [英] Transition from RestKit to pure AFNetworking 2.0

查看:342
本文介绍了从RestKit转换到纯AFNetworking 2.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

过去两年我一直在使用RestKit,但最近我开始考虑从这些巨型框架转换,因为它似乎真的太过分了。

I'd been using RestKit for the last two years, but recently I've started thinking about transition from these monolith framework as it seems to be really overkill.

这是我的继续前进的职业:

Here's my pros for moving forward:


  1. 使用NSURLSession进行后台抓取有很大的需求,RestKit只有实验分支过渡到AFNetworking 2.0。转换时没有实际日期。 (主要原因)

  2. 无需网络库中的CoreData支持,无需完全功能的离线数据存储。

  3. 与响应/请求描述符的新概念,因为它们不支持路径模式中的不同参数(例如访问令牌参数),并且没有办法在具有定制描述符的一行中创建对象请求操作。在这里,我失去了对象管理器作为立面的功能。

对象映射过程中。
您能推荐您使用的独立库,显示自己灵活和稳定吗?

I. The biggest loss of RestKit for me in object mapping process. Could you recommend standalone libraries that you use which shows themselves as flexible and stable?

II。由于我很伤心,我需要没有完全正常的存储, em> caching support
我听说NSURLCache在最后的操作系统版本中变得有用。
你使用它,什么是策略?
当网络连接关闭时返回缓存的 API响应

II. And as I sad I need no fully functional storage but I still need some caching support in some places. I've heard that NSURLCache has become useful in last OS release. Did you use it and what's the strategy? Does it return cached API responses when network connection is down?

III。同样的问题?
您应用了哪些解决方案?
也许有人可以给出一些关于建筑的建议建议,他/她在多个应用程序中使用纯AFNetworking?

III. Does anybody faces the same problems? What solutions have you applied? Maybe someone could give some piece of advice about architecture that he or she uses in multiple apps with pure AFNetworking?

推荐答案

我。与其他已评论的人员一致,AFNetworking + Mantle 是与Restful API进行交互的简单有效的方式并替换您错过的RestKit的对象映射过程。

I. In agreement with others who have commented, AFNetworking + Mantle is a simple and effective way to interact with a Restful API and to replace RestKit's object mapping process that you miss.

II。回答您的缓存支持的要求高度依赖于上下文。然而,我发现我最近的功能需求缓存一个视图模型为一个特定的控制器的屏幕,只缓存由API返回的参考数据允许我保持应用程序逻辑相对简单,同时给用户一些连续性。针对连接问题的简单错误通知可以以交叉方式处理。

II. To answer the requirements of your caching support is highly dependent on the context. However, I have found for my recent functional requirements that caching a view model for a particular controller's screen and only caching reference data returned by APIs allows me to keep the application logic relatively simple whilst giving the user some continuity. A simple error notification for connectivity issues can be dealt with a cross-cutting manner.

三。与这方面相关的架构的一个想法是确保应用程序依赖的API根据应用程序体验提供数据。这允许您的应用程序专注于它的擅长(一个非常漂亮的用户体验),并将逻辑移动到API更接近API依赖关系,如数据。这有进一步的好处,减少应用程序的chattiness。

III. One thought on the architecture relevant to this aspect is to ensure that the APIs the app is dependent on provides data according to the app experience. This allows your app to focus on what it is good at (a very slick user-experience) and moves logic into the API's closer to API dependencies such as data. This has a further benefit of reducing the chattiness of the app.

这篇关于从RestKit转换到纯AFNetworking 2.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆