Working with RAC can be very helpfull, but sometimes, you need avoid completion blocks that iOS requires. I don’t like delegate methods in top of them, because theirs realization takes a lot of boliepriate code, methods, checks etc.
So here is my realization of NSURLSession for working with RAC.

 

In handle methods you can handle received data, and add some modifications, or checks. Also, in my case, from server comes always wrapped object, this means, when I finish tranform it with NSJSONSerialization  I will receive NSDictionary , so if you not sure in your case, just pass type id

 

Also, good idea to check status variable for nil, I will keep in mind…

What about error hadling? In all my apps I creating global class, that will handle all errors. This class shows alerts, or toasts, messages on a app-level. Also all signals will contain error, so classes that working now and waiting for this signals, can handle it.

 


Oksana Kovalchuk

Passionate IOS Developer

Related Posts

Snippet

Git cloning with sub-modules

For cloning  git repo with submodules, use this command: [crayon-5976201f49c0f691917054/] For already cloned repos, for clone submodules use next command in repo root: [crayon-5976201f49c16589370826/] And that’s all, Folks. Related