EXC_BAD_INSTRUCTION happens when using dispatch_get_global_queue on ios 7(swift)

前端 未结 2 1674
小蘑菇
小蘑菇 2021-01-18 07:07
    let downloadGroup = dispatch_group_create()
    var images = [UIImage]()
    var errors = [NSError]()
    dispatch_apply(UInt(urls.count), dispatch_get_global_qu         


        
2条回答
  •  一整个雨季
    2021-01-18 07:26

    found out the reason seconds after i posted. it seems not me being stupid, but apple's document

    QOS_CLASS_USER_INTERACTIVE, QOS_CLASS_USER_INITIATED, QOS_CLASS_UTILITY, or QOS_CLASS_BACKGROUND
    

    can not be used on ios7, though https://developer.apple.com/library/ios/documentation/Performance/Reference/GCD_libdispatch_Ref/#//apple_ref/c/func/dispatch_get_global_queue
    doesn't bother to metion any of it instead use

    DISPATCH_QUEUE_PRIORITY_HIGH, DISPATCH_QUEUE_PRIORITY_DEFAULT, DISPATCH_QUEUE_PRIORITY_LOW, DISPATCH_QUEUE_PRIORITY_BACKGROUND
    

提交回复
热议问题