【问题标题】:iOS asihttp nslog requestiOS asihttp nslog 请求
【发布时间】:2011-12-08 05:15:11
【问题描述】:

我需要记录在 ASIHTTP 中使用的请求

   NSURL *url = [NSURL URLWithString:@"https:// tor.or rd.net.au/OnlineService.svc/JSON/G "];

    ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];

    [request setDelegate:self];

    [request setPostValue:@"b07db55065b922fdae9" forKey:@"token"];
    [request setPostValue:@"2312" forKey:@"points"];

    [request startSynchronous];
    //hasta aqui!
    NSString *response = [request responseString];

    NSLog(@"the request ::%@", request );

    NSLog(@"respond ::%@", response);

但我在我的 nslog 中得到了这个

     the request ::<ASIFormDataRequest: 0x7b62a00>

我想查看 URL 和正文(字典)

那么我如何格式化要记录的响应, 谢谢!

【问题讨论】:

    标签: iphone ios asihttprequest nslog


    【解决方案1】:

    ASIFormDataRequestASIHTTPRequest 的子类,

    要查看网址,请使用NSLog(@"the request ::%@", [request originalURL]);

    【讨论】:

      【解决方案2】:

      几天前我也有同样的问题。想通了,解决办法如下:

      转到 ASIHTTPRequestConfig.h 文件并查找第 20 行。它将是

       // When set to 1, ASIFormDataRequests will print information about the request body to the console 
      #ifndef DEBUG_FORM_DATA_REQUEST
      #define DEBUG_FORM_DATA_REQUEST 0
      #endif
      

      所以要记录请求正文只需将 0 更改为 1。所以它会是这样的:

       // When set to 1, ASIFormDataRequests will print information about the request body to the console 
      #ifndef DEBUG_FORM_DATA_REQUEST
      #define DEBUG_FORM_DATA_REQUEST 1
      #endif
      

      享受。希望对你有帮助:)

      【讨论】:

        【解决方案3】:

        这就是请求。它是指向请求对象的指针的日志。您还在寻找什么?

        【讨论】:

        • 嗨,谢谢,我想看看指针内容?,URL和正文与字典?,干杯
        • 再往下检查,其他答案应该是准确的。
        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多