是否有可能取消一個線程while performSelector waitsUntilDone?performSelector NSThread問題
見下文:
我有以下行while循環:
[self performSelector:@selector(getMyRecords:) onThread:myThread withObject:i waitUntilDone:YES]
有時候,我要取消我的線程myThread
,而我的循環執行。我獲得以下崩潰問題:
Terminating app due to uncaught exception 'NSDestinationInvalidException', reason: '*** -[MyController performSelector:onThread:withObject:waitUntilDone:modes:]: target thread exited while waiting for the perform'
這個答案與問題無關 – 2018-02-23 18:22:20
它回答了這個問題。說你不能取消 – RaffAl 2018-02-23 18:52:05
問題是關於取消*線程*,而不是發佈的消息。您建議使用另一種排隊消息的方法,以便修復停止線程的崩潰。這是一個非常誤導性的答案。 – 2018-02-25 21:03:29