【发布时间】:2015-02-19 12:45:25
【问题描述】:
我正在使用 NSURLConnection 与服务器进行通信和传递/获取数据。我只发送一次请求,但服务器的访问日志显示它正在接收多个请求。我试图记录我发送到服务器的请求,但它只打印一次。向服务器发送请求的代码是:
NSURL *url=[NSURL URLWithString:[[NSString stringWithFormat:@"%@/services/OtherProcess/Status",serverIP]stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding]];
NSLog(@"Sending URL -> %@",url);
NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:url];
if(connection)
[connection cancel];
connection=[NSURLConnection connectionWithRequest:theRequest delegate:self];
responseData = [[NSMutableData alloc] init];
我什至尝试添加断点,发现它只被调用一次。任何帮助都会很有用。
【问题讨论】:
标签: ios xcode nsurlconnection