GCD信号

作者: 随你丫居士 | 来源:发表于2020-10-20 14:52 被阅读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

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

    • 会断开网络
    • 移除所有view
    • AppDelegate所有属性滞空
    • 调用didFinishLaunchingWithOptions

    相关链接

    GCD信号量-dispatch_semaphore_t

    相关文章

      网友评论

          本文标题:GCD信号

          本文链接:https://www.haomeiwen.com/subject/wvldmktx.html