2014-11-25 22 views
-1
- (void)cancel { 
    [self.lock lock]; 
    if (![self isFinished] && ![self isCancelled]) { 
     [self willChangeValueForKey:@"isCancelled"]; 
     _cancelled = YES; 
     [super cancel]; 
     [self didChangeValueForKey:@"isCancelled"]; 

     // Cancel the connection on the thread it runs on to prevent race conditions 
     [self performSelector:@selector(cancelConnection) onThread:[[self class] networkRequestThread] withObject:nil waitUntilDone:NO modes:[self.runLoopModes allObjects]]; 
    } 
    [self.lock unlock]; 
} 
+1

是的,你有這個代碼。和?什麼是失敗? – Cyrille 2014-11-25 14:54:07

+0

對不起;)_cancelled =是;行出現錯誤:使用未聲明的標識符 – 2014-11-25 14:57:56

+0

您是否已經聲明瞭相應的伊娃,或者在您的班級中是否已取消了@ @屬性(...)? – Cyrille 2014-11-25 14:59:12

回答

0

我認爲這個問題還描述了here

你可以找到一行:「當我合成它我自己,它開始工作正常。 @synthesize取消= _cancelled」。

因此,只需找到@implementation AFURLConnectionOperation並添加合成:@synthesize cancelled = _cancelled;如果它來自AFURLConnectionOperation,它應該刪除該問題。

相關問題