Questions tagged [dispatch-async]
437 questions
3
votes
3 answers
Swift how to dispatch_queue to update tableview cell
My app needs to fetching data from a server before loading the tableview.
How to using dispatch_async to make app updating the cell view after completing fetching data.
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath:…

Janice Zhan
- 571
- 1
- 5
- 18
3
votes
2 answers
dispatch_async block on main queue is not executed in a modal run loop
I have the following code that checks the RunLoop in an outerloop and then dispatches to the main_thread in an inner loop using dispatch_after. I have two cases where this is called, once when a button is pressed on the nav bar, and the other case…

nishant
- 736
- 1
- 12
- 22
3
votes
2 answers
Why does the block after dispatch_async(dispatch_get_main_queue() never get called?
I want to execute some code asynchronously and have for this reason started using GCD for OSX/iOS.
Currently I am using the function dispatch_async().
When I want to execute something concurrently on another thread, I use the function…

D_Men
- 53
- 1
- 5
3
votes
1 answer
How to declare `dispatch_function_t` for `dispatch_async_f` in Swift?
Xcode 7 beta 5. I'm attempting to use dispatch_async_f to avoid a block.
func myFirstFunc() {
let identifier = QOS_CLASS_BACKGROUND
let queue = dispatch_get_global_queue(identifier, 0)
let context: UnsafeMutablePointer = nil
…

Cœur
- 37,241
- 25
- 195
- 267
3
votes
1 answer
Show indicator when save core data Swift
I have a button to save picture data in core data but when I push it, it is freezing because size of the data is big. I did try to use dispatch_async but it didn’t work. How do I create the icon/indicator showing that it is loading/bookmarking…

user2952122
- 75
- 1
- 6
3
votes
2 answers
Stop or completely erase iOS Global Dispatch Queue
So I have read several posts on here about the queueing system but I cannot seem to figure out how to do what I am looking for. Currently I am going to a page and loading images using a loop, and each image uses async dispatch seen…

CMOS
- 2,727
- 8
- 47
- 83
3
votes
1 answer
UIProgressView progress update very slow within AlamoFire (async) call
Inside an AlamoFire get request I'm trying to update my progress bar. Like so:
alamofireManager.request(.GET, urlPath, parameters: params).responseJSON{(request,response,JSON,error) in
...
...
…

Boid
- 1,161
- 1
- 11
- 21
3
votes
2 answers
Does dispatch_after block the main thread?
I'm setting a timer so that after a second passes I reset a value for my keyboard extension. The problem is that I feel like the following call is stalling my UI:
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 1 * NSEC_PER_SEC),…

KingPolygon
- 4,753
- 7
- 43
- 72
3
votes
5 answers
dispatch_async for getting many images from url
I want to get many images from diffrent url and set it like image's buttons .
I was trying to do this like it's showing above but nothing is happen . When i access this view controller it doesn't have any image for buttons and also neither the…

Georgiana
- 127
- 3
- 11
3
votes
1 answer
Calling NSURLConnection inside dispatch_async and reading didReceiveResponse in mainRunLoop in iPhone development
What I am trying to do is getting response for following method
- (void) connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response { }
after calling this
NSURLConnection *conn = [[NSURLConnection alloc]…

AnujAroshA
- 4,623
- 8
- 56
- 99
3
votes
1 answer
gcd/dispatch_async and CoreData freezes app
For some reason using dispatch_async and Core Data together causes my app to completely freeze, but not crashed.
Symptom
The user interface is not responsive. The app does not crash.
The app uses [[UIAccelermeter sharedAccelerometer] setDelegate:…

Daniel
- 1,101
- 9
- 18
3
votes
1 answer
dispatch_async block not getting invoked
MySynchManager class is having a shared instance.
One of the function in MySynchManager class is
- (void)uploadSession:(NSString *)sessionId {
// run the upload process on a separate thread to not to block the main thread for user interaction
…

ganapathi raju
- 49
- 1
3
votes
1 answer
Unit testing for code like dispatch_async.
Need to do unit testing for the following code, dispatch_async means code won't be executed by app logic sequence, any idea on how to make it run timely?
Thank you.
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0), ^{
…

jianhua
- 1,011
- 1
- 12
- 28
2
votes
1 answer
React/Redux with hooks to fetch from Rails API
I am trying to use redux and hooks with my rails / react application and running into a weird problem. When I first console log my list object that is being fetched, they display fine in the console and render correctly
See this picture
Here is my…

Jess Pesale
- 43
- 6
2
votes
1 answer
How to get notified after looping through Alamofire requests using DispatchQueue in Swift?
I have this code to get a list of ids and names that are parsed from a JSON through an iteration of calls.
Problem is I don't know how to get notified, a simples print("finished"), would do. I tried to use print command after the 'for' loop but it…

Marco Almeida
- 1,285
- 3
- 17
- 39