codeperson
codeperson

Reputation: 8050

Best practice for checking if DISPATCH_QUEUE_PRIORITY_BACKGROUND exists?

Apple's documentation clearly states that DISPATCH_QUEUE_PRIORITY_BACKGROUND is only available in iOS 5 or later. What is the correct way to check if it's available in the runtime environment?

Upvotes: 1

Views: 494

Answers (2)

das
das

Reputation: 3681

If you are building against iOS 5 SDK or later, it is safe to simply call dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0) and check for a non-NULL return value.

Upvotes: 4

borrrden
borrrden

Reputation: 33421

Check the version of the OS and see if it is greater or equal to 5

Upvotes: 0

Related Questions