ios - Swift 3: Can not convert value of type 'int' to expected argument type 'DispatchQueue.GlobalQueuePriority' -


swift 3.0: receiving error can not convert value of type 'int' expected argument type 'dispatchqueue.globalqueuepriority' on creating dispatch async queue

dispatchqueue.global(priority: 0).async(execute: { () -> void in  }) 

warning, deprecated in ios 8, see below latest

dispatchqueue.global expects dispatchqueue.globalqueuepriority enum, is:

  • high
  • default
  • low
  • background

so in case, write:

dispatchqueue.global(priority: .background).async(execute: { () -> void in  }) 

if want lowest priority.

a quick check reveals, dispatchqueue.global(priority:_) deprecated in ios 8.

latest solution:

dispatchqueue.global(qos: .background).async {  } 

which gives more options choose from:

  • background
  • utility
  • default
  • userinitiated
  • userinteractive
  • unspecified

Comments

Popular posts from this blog

unity3d - Rotate an object to face an opposite direction -

angular - Is it possible to get native element for formControl? -

javascript - Why jQuery Select box change event is now working? -