2012-11-09 94 views
2

取消可能會停止AFHTTPRequestOperation的實例,但有時會失敗。如何停止AFHTTPRequestOperation?

任何人都有解決方案來立即停止AFHTTPRequestOperation實例或延遲秒?

+0

可以編輯你的問題,顯示的代碼顯示您目前如何取消請求操作一點點?並且該操作在與您要求取消的線程分離的線程上,對嗎? –

+0

也許這將有助於 - http://stackoverflow.com/questions/12361824/how-to-immediately-force-cancel-an-nsoperation-with-afnetworking – Anthony

回答

0

AFAIK,沒有什麼比你能用AFHTTPRequestOperation做的更多!

AFHTTPRequestOperation *operation = [AFHTTPRequestOperation operationWithRequest:request success:success failure:failure]; 
[self.operationQueue addOperation:operation]; 
[operation performSelector:@selector(cancel) withObject:nil afterDelay:.5];