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.
阿萨德
在将UIAlertView
和UIActionSheet
升级为 UIAlertController
过程中
发现UIAlertController
的 UIAlertControllerStyleAlert
类型不能同时展示两个 它并不会像UIAlertView
一样 后创建的叠加到先创建的UIAlertView
上面 所以需要一个线程等待管控一下 选用GCD的信号量
实现当点击了UIAlertAction
后才加载下一个UIAlertController
但是我们测试环境下有个切换 测试网络环境的浮窗 当点击切换网络环境时
- 会断开网络
- 移除所有
view
-
AppDelegate
所有属性滞空 - 调用
didFinishLaunchingWithOptions