0

我正在调用NSURLConnection-sendSynchronousRequest在 NSOperation 中,但该方法立即返回。我希望它会阻止操作,直到收到所有数据。这是我的误解吗?

4

1 回答 1

0

将 NSURLConnection 对象的委托设置为 self

NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self];
然后实现connectionDidFinishLoading方法e
-(void)connectionDidFinishLoading:(NSURLConnection *)connection{
//your code
}

于 2012-06-04T10:44:22.007 回答