Adapted code for AFNetworking 2.x