Questions tagged [dispatch-async]

437 questions
2
votes
2 answers

Why does this block not capture variable value at time of creation

I have the following problem in Objective-C using GCD I cannot figure out: I am using the following method to calculate something for some 648 tiles. The order of which tiles to process first is given by some algorithm setting the variable "pi". The…
Thomas Krajacic
  • 2,488
  • 1
  • 21
  • 25
2
votes
2 answers

What's difference dispatch_async in for statement or not

I am wondering what the differences are between using dispatch_async in the following methods denoted 'A' and 'B'. A dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ for (int i = 0; i < 10; i++) { //…
2
votes
2 answers

Cant dismiss UIAlertView, buttons not clickable

I have the following code where i show a MBProgress view and then run code in a separate thread. I then get a handle to the main thread and dismiss the spinner which works and then i show a UIAlertView. The UIAlertView loads fine however i can not…
Scoota P
  • 2,622
  • 7
  • 29
  • 45
1
vote
0 answers

DispatchSemaphore + DispatchQueue not working as expected?

I'm trying to improve the time it takes for a task to finish by leveraging multithreading/paralleling. I'm reading CMSampleBuffers from a video track, manipulating them, then storing them back to an array for later use. Because each manipulation is…
Roi Mulia
  • 5,626
  • 11
  • 54
  • 105
1
vote
0 answers

How to wait for redux dispatch to finish before another dispatch?

addOrder = (event) => { this.props.dispatch({ type: 'POST_ORDER', payload: this.state.newOrder, }); this.props.dispatch({ type: 'GET_ORDER_DETAILS', payload: this.props.store.orders.length + 2, }); …
FrostyKC
  • 23
  • 2
1
vote
1 answer

How to resolve async chaining using thunk in redux

I am trying to dispatch two posts at the same time using thunk in Redux but when I try to dispatch the second post I am missing the user id from the previous post. There might be a process on how to async chain these requests but I haven't been…
Bebe
  • 77
  • 1
  • 14
1
vote
0 answers

TS: Uncaught Reference error with async actions / services in react ts

I am working on react typescript project where i have login action for user authentication. It is working fine and return result. Below is my function export const login = (email: string, password: string) => { return…
Afzal Ali
  • 880
  • 8
  • 25
1
vote
0 answers

How to improve Lottie loading performance (load 23 Lotties in a collection stack views)

I faced a several problem to load a collection of Lottie animations. I explain my code. I have a storyboard which contains 24 views. In my view controller, It's referenced as a collection of IBoutlet with AnimationView as type like this @IBOutlet…
Benjamin
  • 83
  • 1
  • 8
1
vote
1 answer

dispatchgroup executes task in different order in testflight compared to simulator

So my goal is to have congruent functionality both on the iOS simulator in Xcode and as well as a physical device on TestFlight. So currently, I have a function that handles refunds in my app. On the simulator the function runs perfectly fine in the…
1
vote
1 answer

PickerView not getting the updated value from Array

First of all please correct my topic subject or suggest an edit for the taggin in case if I mentioned somthing wrong. I'm working on a store App project and I stuck in the selecting subSection VC because of the UIPickerView not getting the updated…
Let.Simoo
  • 93
  • 9
1
vote
1 answer

How to set timer in one vc and fire it in another vc

my goal is to set a timer in one vc when a firestore document is created and fire it in another vc when the timer is up to delete the firestore document. In my vc where I create the document, I have this block of code in the button that creates the…
dsonawave
  • 137
  • 2
  • 12
1
vote
1 answer

Do I need to Block_release dispatch_block_t which is in the dispatch_barrier_async when no ARC

Do I need to Block_release dispatch_block_t which is in the dispatch_barrier_async when no ARC ? I noticed "The barrier block to submit to the target dispatch queue. This block is copied and retained until it finishes executing, at which point it is…
1
vote
0 answers

Swift UI Queues and DispatchQueue.main.async

I'm currently building a game in Swift that overlays a 'd-pad' and various other items such as a score label and start label on the game itself. Those items are set up in an SCNView, while the game itself, consisting of a ship and tunnel, is built…
1
vote
1 answer

DispatchQueue threads don't always set the correct results

Am trying on coding game MineSweeper, the following code is to set the numbers around landmines. For a test, I choose the minimum level 9 x 9 with 10 landmines. For a faster performance, I tried to use more threads when setting numbers, but one day…
jdleung
  • 1,088
  • 2
  • 10
  • 26
1
vote
1 answer

Max values of semaphore?

For example, there is a 1000 times loop. What's the max value to make it fast, effective, and not lead to a deadlock? let group = DispatchGroup() let queue = DispatchQueue(label: "com.num.loop", attributes: .concurrent) let semaphore =…
jdleung
  • 1,088
  • 2
  • 10
  • 26