patrick patrick - 3 years ago 183
iOS Question

upgrading to XCode 8 broke my ability to build on my iOS 6 device?

I recently upgraded to XCode 8, and found that I can no longer build on my iPhone5 with iOS 6... Fortunately I kept around XCode 7, but apparently since I installed XCode 8, I somehow lost some linking for a dispatch queue symbol? When I try to run my app with XCode 7 on iOS 6, I now get an immediate crash:

dyld: lazy symbol binding failed: Symbol not found: _dispatch_queue_attr_make_with_qos_class
Referenced from: /var/mobile/Applications/0FE3B5A4-00AA-46F3-80A7-8EA45C64BEAE/
Expected in: /usr/lib/libSystem.B.dylib

How can I resolve this?

Answer Source

Read the documentation for dispatch_queue_attr_make_with_qos_class. Note when it was added - iOS 8. You have to guard against the use of that function when run under iOS 7 or 6.

As documented in the SDK Compatibility Guide, you can do this:

if (dispatch_queue_attr_make_with_qos_class != NULL) {
    // use dispatch_queue_attr_make_with_qos_class as needed
} else {
    // The function doesn't exist for this device, do something else
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download