EXC_BAD_INSTRUCTION happens when using dispatch_get_global_queue on ios 7(swift)

血红的双手。 提交于 2019-12-01 17:14:36

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

In my view, your main question is not global queue,is this method dispatch_get_main_queue. Please check it on API Documentation. It's used in iOS 8.0+ only, I choose to use - (void)performSelectorOnMainThread:(SEL)aSelector withObject:(id)arg waitUntilDone:(BOOL)wait instead.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!