dispatch-async Questions

4

Solved

I am hitting a web service url 10 times and getting the response. I am using Alamofire and SwiftyJSON. This is my controller code class ViewController: UIViewController { let dispatchGroup = Dis...

4

Solved

Please explain to me why I am getting this crash? Thread 1: EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0) in this DispatchQueue.main.sync { print("sync") } This is my code. o...
Ire asked 13/3, 2018 at 14:11

2

As must of the applications in the world, my React application needs to perform some Ajax calls to an API. I've chosen to use Redux middlewares in order to correctly separate API fetching from my ...
Rodney asked 5/7, 2018 at 8:4

4

Solved

Our team seriously need some help with the following problem that we are facing as it is preventing us from debugging some of the code inside dispatch_async block. Hope I will get some help or sug...
Ethology asked 8/10, 2014 at 10:16

8

Solved

I have a scenario in my app, where I want to do some time consuming task which consists of some data processing as well as UI update, in a method. My method looks like this, - (void)doCalculations...

2

Solved

Does this always print in the order of 1 5 2 4 3? print("1") DispatchQueue.main.async { print("2") DispatchQueue.main.async { print(3) } print("4") } print("5") I feel the answer is no, bu...
Guardsman asked 10/10, 2018 at 5:23

6

Solved

I have lots of code in Swift 2.x (or even 1.x) projects that looks like this: // Move to a background thread to do some long running work dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PR...
Verdieverdigris asked 14/6, 2016 at 0:58

6

Solved

I have been using with success, grand central dispatch in my apps, but I was wondering what is the real advantage of using something like this: dispatch_async(dispatch_get_main_queue(), ^{ ... do ...
Harslet asked 26/10, 2011 at 15:42

3

Solved

I read other posts that come up with solutions to this question. However, their solutions require hacky code to be added to my application in order to be able to test it. To me clean code is more i...
Flute asked 17/9, 2012 at 16:45

1

I have a fairly simple app that parses a RSS feed and shows it's content in a table view. It's available on the App Store. I have Crashlytics crash reporting integrated. I recently received two rep...

1

Solved

I understand that all UI updates must be done from Main thread. But purely for the sake of deeper understanding how GCD and dispatch main work: I have a button that runs a network call and in its...
Helpmeet asked 5/7, 2017 at 16:40

2

Solved

I have created an overlay to run while I run an async data grab to the server so that users won't continue pressing buttons in the UI until the data grab is done. I have put the function into a glo...
Jameejamel asked 23/6, 2017 at 19:38

4

Solved

I have this code: DispatchQueue.global(priority: DispatchQueue.GlobalQueuePriority.default).async { let url = URL(string: itemImageURL ) let data = try? Data(contentsOf: url!) if data != nil { ...
Sicilia asked 30/9, 2016 at 11:59

1

Solved

I hve following cycle in my app var maxIterations: Int = 0 func calculatePoint(cn: Complex) -> Int { let threshold: Double = 2 var z: Complex = .init(re: 0, im: 0) var z2: Complex = .init(...
Cavell asked 9/10, 2016 at 20:13

2

The following code will occupy ~410MB of memory and will not release it again. (The version using dispatch_sync instead of dispatch_async will require ~8MB memory) I would expect a spike of high me...

2

Solved

I have the following code that I've been trying to translate into swift 3 from swift 2. Here is what I have so far. DispatchQueue.async(group: DispatchQueue.global(DISPATCH_QUEUE_PRIORITY_DE...
Sprang asked 28/9, 2016 at 10:4

2

Solved

I got quite a lot of confusion on async tasks in swift. What i want to do is something like this... func buttonPressed(button: UIButton) { // display an "animation" tell the user that it is calc...
Philip asked 31/8, 2016 at 13:10

3

Solved

What this piece of code mean? dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ TMBaseParser *parser=[[TMBaseParser alloc] init]; parser.delegate=self; NSString *...
Brebner asked 16/5, 2013 at 14:14

3

I have question around this code dispatch_async(dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ NSData* data = [NSData dataWithContentsOfURL: kLatestKivaLoansURL]; [self pe...
Absinthe asked 29/4, 2013 at 16:27

1

I am looking at the Ray Wenderlich tutorial on using dispatch queues to get notified when a group of tasks complete. http://www.raywenderlich.com/63338/grand-central-dispatch-in-depth-part-2 The f...

1

I am trying to debug a crashing bug reported by many of my users in the field. All show me the same stack: Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x0000000000000000, 0x00000000000000...
Borges asked 25/10, 2015 at 6:25

1

Solved

I'm trying to understand queue in iOS; with this code dispatch_queue_t coda_thread=dispatch_queue_create("coda_thread",NULL); //UIPROGRESS VIEW for(i=0;i<=10;i=i+1) { dispatch_async(coda_thre...

2

Solved

Following TDD I'm developing an iPad app that downloads some info from the internet and displays it on a list, allowing the user to filter that list using a search bar. I want to test that, as the...

2

Solved

I'm loading a javascript which is in my App, the script will try to find a solution, which can takes some time. I don't want to wait more than 5 seconds for that solution, in that case I just want ...
Encephalogram asked 8/2, 2015 at 1:34

1

Solved

I've been looking for an answer to this and some seem like they might be what I need but I'm not sure. I found this Question #9152851 and this Question #2617625 and poked around on a bunch of links...
Bureaucrat asked 17/10, 2013 at 18:17

© 2022 - 2024 — McMap. All rights reserved.