Questions tagged [dispatch-async]

437 questions
7
votes
1 answer

What could trigger a SIGABRT on dispatch_async in iOS9.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, 0x0000000000000000 Exception Note: EXC_CORPSE_NOTIFY Triggered by…
esilver
  • 27,713
  • 23
  • 122
  • 168
6
votes
3 answers

Synchronise multiple web service calls in serial order in swift

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 = DispatchGroup() var weatherServiceURL =…
6
votes
4 answers

Xcode breakpoint don't work inside dispatch_async block

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 suggestions on what to do next. The problem we faced is…
garfieldmypet
  • 187
  • 1
  • 7
5
votes
2 answers

swift: async task + completion

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 calculating (do not want to freeze the screen // do…
user6539552
  • 1,331
  • 2
  • 19
  • 39
5
votes
4 answers

What is purpose of dispatch sync?

I'm pretty clear what dispatch_async queue is performing, but I'm not clear what dispatch_sync purpose is. For an example: what is difference between this: NSLog(@"A"); NSLog(@"B"); and this: dispatch_sync(dispatch_get_main_queue(), ^…
Stefan
  • 1,283
  • 15
  • 33
5
votes
2 answers

Test code with dispatch_async calls

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 user types in the search bar, the internal variable…
5
votes
1 answer

NSRunLoop runMode does not always process dispatch_async

I'm trying to get a better understanding of queues and how they work. This snippet is to test their behaviour: - (void)dispatchQueueTest { NSLog( @"Begin test on %@ thread", [NSThread isMainThread] ? @"main" : @"other" ); …
4
votes
0 answers

swiftUI modally (sheet) presented list doesn't work the second time

I am using beta 4 Xcode and simply have a list of string items that is modally presented from a main view. var body: some View { NavigationView { List { Section() { Button(action: { …
Congruent Tech. UG
  • 1,408
  • 2
  • 12
  • 21
4
votes
2 answers

How to dispatch actions from Redux middleware in correct order

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 components. The idea is to dispatch REQUEST actions…
KorHosik
  • 1,225
  • 4
  • 14
  • 24
4
votes
3 answers

Uncaught (in promise) Error: Request failed with status code 404

I am getting above error while fetching some data from the API. Following is the code of the action creator where I am trying GET the data: import { FETCH_USER } from './types'; import axios from 'axios'; export const fetchUser = () => async…
Ishan Patel
  • 5,571
  • 12
  • 47
  • 68
4
votes
2 answers

Why using dispatch_async is so slow compared to not using it at all?

I wanted to know why my code runs much slower when I use dispatch_async compared to when I don't use it at all. I'm trying to blur the edges of my UIImage by masking it and using UIGraphicsImageRenderer (Not sure if it's the most efficient way or…
Reza.Ab
  • 1,195
  • 1
  • 11
  • 21
4
votes
2 answers

Swift dispatch_async results in EXC_BAD_ACCESS error

In my Swift project, I'm trying to process a FIFO queue (I will call it a list here to avoid confusion) in a background thread. When I use dispatch_async, it results in a EXC_BAD_ACCESS error after only some of the list has been executed. I've…
Matt
  • 43
  • 5
4
votes
1 answer

How to stop or cancel execution of dispatch block

I want to execute multiple dispatch block at same time. So when any dispatch block is in progress at same time when I run 2nd dispatch block, I want to stop execution of previous dispatch block. I'm using this below code…
Monika Patel
  • 2,287
  • 3
  • 20
  • 45
4
votes
2 answers

Use dispatch_async to analyze an array concurrently in Swift

I am trying to analyze a photo concurrently using a background thread from GCD. Here is the code I have written: dispatch_async(dispatch_get_global_queue(Int(QOS_CLASS_UTILITY.value), 0)) { for (var i = 0; i < 8; i++) { let color =…
4
votes
5 answers

UIImageView is NIL

I have a default image in viewItem to make sure that it is working, it shows on the detail view of the splitview. @IBOutlet weak var ImageView: UIImageView! var imageCache = [String: UIImage]() override func viewDidLoad() { …
Jason G
  • 2,395
  • 2
  • 24
  • 34
1
2
3
29 30