GCD信号

2020-10-20  本文已影响0人  随你丫居士

dispatch_semaphore_t 必须与dispatch_semaphore_wait成对出现
dispatch_semaphore_t 次数大于dispatch_semaphore_wait不会导致崩溃 但让信号量无故增加可能会导致不在预期的bug
dispatch_semaphore_t 次数小于dispatch_semaphore_wait会导致崩溃
Calls to dispatch_semaphore_signal must be balanced with calls to wait(). Attempting to dispose of a semaphore with a count lower than value causes an EXC_BAD_INSTRUCTION exception.

阿萨德

在将UIAlertViewUIActionSheet升级为 UIAlertController过程中
发现UIAlertControllerUIAlertControllerStyleAlert类型不能同时展示两个 它并不会像UIAlertView一样 后创建的叠加到先创建的UIAlertView上面 所以需要一个线程等待管控一下 选用GCD的信号量
实现当点击了UIAlertAction后才加载下一个UIAlertController

但是我们测试环境下有个切换 测试网络环境的浮窗 当点击切换网络环境时

相关链接

GCD信号量-dispatch_semaphore_t

上一篇 下一篇

猜你喜欢

热点阅读