嗨 我使用 5.5 版本的 mysql 连接。版本 mysqllibclient. 如果我看到 isCancelled 开始为 yes,是否有一种方法可以停止 mysql 查询? 定时器在 nsoperation 中工作不稳定,我不知道为什么(请参阅我关于 nstimer 问题的问题,它没有得到解答)。
最佳答案
// you have two immediate options:
// 1) override cancel:
- (void)cancel {
[super cancel];
/* get out */
}
// 2) test isCancelled
- (void)main {
/* ... */
if (self.isCancelled) {
/* get out */
}
else {
/* continue working */
}
/* ... */
}
关于cocoa - NSOperation子类cancel的正确编程方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5345478/