In Swift how to call method with parameters on GCD main thread? -


In my app I have a function that creates an NSRURL session and uses

  Sesh.dataTaskWithRequest (req, completionHandler: {(Data, Feedback, Error)  

In this whole block of work, I need to make some calculations which call Adds a UIImage to the View Controller if I calculate the UIMAJ-add, so if I try to run it then the integer To see the code inside the block, Xcode says an error that I can not use the layout engine in the background process, so I found some code on SO, which tries to line a method on the main thread:

itemprop = "text">

Just type it in the completion handler . There is no need to use dispatch_start_start

  dispatch_async (dispatch_get_main_queue ()), {Representative Representative OBZ = UIApplication Edit Your Ad Representative as the representative of the Cloud. Oz UDIJ ("your strings")}  

Swift 3:

  Dispatch Queue .main.async {delegateObj = UIApplication SharedApplication () Representative to  for remittance to the main line   
  Dispatches Queue as YourAppDelegateClass delegateObj.addUIIage ("yourstring")}  

.main.asyncAfter (deadline: .now () + 0.1) {// your code here}

change YourAppDelegateClass representative class with you


Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

c# - Create dynamic LINQ query expression at runtime which translates into a parameterized SQL query for nullable types -

cmake - cpack generates RPMs with %files entries that conflict with the RPM spec. How to fix? -