如何使用Xcode 4在iphone模拟器上打印TEXT_PLAIN格式的http响应接收数据?

时间:2014-06-03 06:18:26

标签: java objective-c xcode tomcat ios-simulator

我正在通过iphone模拟器与Apache服务器通信。当我从我的模拟器发送请求时,apache服务器成功响应。我通过在mac(客户端)上安装wireshark进行检查,但我无法在xcode控制台或iphone模拟器中打印响应值。

我在客户端的响应恢复代码 - :

// CHECKING CONNECTION ONE


-(void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response
{

    _responseData = [[NSMutableData alloc]init];
    NSLog(@"%s checking data ...",_responseData.superclass);
}

-(void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
{
    [_responseData appendData:data];

    NSLog(@"Apended Data.. %d.........%s",data,data);

}

-(NSCachedURLResponse *)connection:(NSURLConnection *)connectiOn willCacheResponse:(NSCachedURLResponse *)cachedResponse
{
    return nil;

}

我的请求响应代码SERVER Side(JAVA) - :

@GET
  @Produces(MediaType.TEXT_PLAIN)
  public String sayPlainTextHello() {
      System.out.println("Request Received Inside text plain method");

      String ram = "Hello Jersey";
    return ram;
  }

在客户端(iphone模拟器)我收到http文本格式的恳求,请建议我如何成功打印响应值。我正在" ?? "在我的回复中。

0 个答案:

没有答案