I'm using NSRunLoop to test asynchronous function in unittest, something like
__block done = NO;
[networkManager POST:url parameters:nil block:^(AFHTTPRequestOperation *operation, id responseObject){
done = YES;
}]
while(!done) {
[[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]];
}
XCTAssert(...)
But NSRunLoop always throw below exception, How to resolve it?
caught "NSInvalidArgumentException", "-[NSRecursiveLock objecID]": unrecognized selector sent to instance ....
Aucun commentaire:
Enregistrer un commentaire