How to print AFNetworking request as RAW data

前端 未结 4 812
轮回少年
轮回少年 2020-12-13 01:39

For debuging purposes I\'d want to print whole request body. I\'m using AFHTTPClient. printing client gives some information, like headers but post/get params are not there.

4条回答
  •  悲哀的现实
    2020-12-13 01:44

    For AFNetworking 3.0 to be able to set the level of logging, you need the following:

    #import 
    #import 
    
    @implementation AppDelegate
    
    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {
        AFNetworkActivityConsoleLogger *logger = [AFNetworkActivityLogger sharedLogger].loggers.anyObject;
        logger.level = AFLoggerLevelDebug;
        [[AFNetworkActivityLogger sharedLogger] startLogging];
    
        return YES;
    }
    

提交回复
热议问题