我正在通过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文本格式的恳求,请建议我如何成功打印响应值。我正在" ?? "在我的回复中。