Quantcast
Channel: Active questions tagged crash - Stack Overflow
Viewing all articles
Browse latest Browse all 7207

How to handle crashes caused by semaphore in iOS?

$
0
0

Crashes when the class is destructed, how to handle unfinished semaphore?

class CrashTestViewCtrl: UIViewController {    private var semaphore = DispatchSemaphore(value: 2)    override func viewDidLoad() {        super.viewDidLoad()        DispatchQueue.global().async { [weak self] in            self?.semaphore.wait()            // do something ......        }    }    deinit {        print("……deinit……")    }}

EXC_BAD_INSTRUCTION


Viewing all articles
Browse latest Browse all 7207

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>