Ios5 NSURLConnection sendAsynchronousRequest:从未调用块

Ios5 NSURLConnection sendAsynchronousRequest:从未调用块,ios5,asynchronous,block,Ios5,Asynchronous,Block,程序流永远不会到达带有NSLog消息的块。我是不是遗漏了什么 [NSURLConnection sendAsynchronousRequest:req queue: [NSOperationQueue mainQueue] completionHandler: ^(NSURLResponse *response_, NSData *data_, NSError *error_) { NSLog(@"Why am I not being calle

程序流永远不会到达带有NSLog消息的块。我是不是遗漏了什么

[NSURLConnection 
    sendAsynchronousRequest:req  
    queue: [NSOperationQueue mainQueue] 
    completionHandler: ^(NSURLResponse *response_, NSData *data_, NSError *error_) {
         NSLog(@"Why am I not being called %@", data_);
    }];

你确定吗?如果您只是在单元测试中进行测试,那么测试将在调用回调之前退出。尝试在以下内容之后添加此内容:[[NSRunLoop main runloop]rununtldate:[NSDate dateWithTimeIntervalSinceNow:1]];你确定吗?如果您只是在单元测试中进行测试,那么测试将在调用回调之前退出。尝试在以下内容之后添加此内容:[[NSRunLoop main runloop]rununtldate:[NSDate dateWithTimeIntervalSinceNow:1]];