Search code examples
iosjsoncocoa-touchafnetworkingmbaas

AFNetworking vs BaaS?


I'm planning to build a simple social app that can allow users to send pictures and text messages. By doing some research I found some people use Backend as a Service(BaaS) to manage database on the server while some people use AFNetworking.

I have two questions that might seem stupid to you:

  1. My iOS programming book used NSURL + NSURLRequest + NSURLSessionTask + NSURLSession to get JSON data from network, why do a lot of people use this third party API AFNetworking?

  2. What's the benefit of using AFNetworking(vs Baas)? Do I have to write my own server code if I use AFNetworking?

Thanks!


Solution

  • These are technologies that operate at different layers. You can assemble an architecture using a combination of these.

    AFNetworking is a good drop-in replacement for NSURL + NSURLRequest + NSURLSessionTask + NSURLSession. It's a client-side networking framework. It's a good choice if you write your own web server.

    Most BaaS platforms have web APIs. AFN would work well with those. So would NSURL*.

    Some BaaS platforms like Firebase offer an iOS SDK. In that case you could use the SDK instead of AFN or NSURL*.