Questions tagged [dispatch-async]
437 questions
2
votes
2 answers
dispatch_get_main_queue() not update UI when move from oneViewController to another ViewController and back again
In my application i perform long task in background. So i used Grand Central Dispatch (GCD) and update the UI in main Queue.
Here is my code
dispatch_async(dispatch_get_global_queue(Int(QOS_CLASS_BACKGROUND.value), 0), {
// perform long…

Rizwan Shaikh
- 2,824
- 2
- 27
- 49
2
votes
1 answer
how can I trace back beyond dispatch_async when debugging an iOS program?
I wonder if anyone knows how can I trace back beyond dispatch_async when debugging my iOS program. My program constant crash at two spots: in buffer_is_unused, as shown in and ,
and in release_shmem_bitmap, as shown in and . None of this happens…

ios learner
- 197
- 1
- 2
- 10
2
votes
1 answer
Why AsyncSocket can't connect to host when using dispatch_async() method?
I'm a little confused when using dispatch_async method to use AsyncSocket.
Here's my code
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
_socket = [[AsyncSocket alloc] initWithDelegate:self];
[_socket…

ray
- 21
- 2
2
votes
1 answer
For loop with background loop, with completion?
I want to run a for loop with background code, that has something happen once it's finished iterating through every item. To do this without background code would be simple, like this:
for aString: String in strings {
if string.utf8Length < 4 {
…

Andrew
- 7,693
- 11
- 43
- 81
2
votes
3 answers
dispatch_async block not called
I've run into an issue I had never seen before. I never thought it might exist. I'm using DFCache library and in a certain moment dispatch_async using global queue doesn't execute block.
- (void)cachedObjectForKey:(NSString *)key completion:(void…

Andrey Chernukha
- 21,488
- 17
- 97
- 161
2
votes
2 answers
Grand central dispatch nesting
I have a piece of code written inside a dispatch async block. Like below:
dispatch_queue_t queue= dispatch_queue_create("action1", NULL);
dispatch_async(queue, ^{
[self method1];
[self method2];
[self…

nr5
- 4,228
- 8
- 42
- 82
2
votes
2 answers
Web page of WKWebView not displaying page inside of dispatch_get_main_queue
I'm trying to create multiple WKWebView views inside of a background process and then add them to a view on the main thread once they are all done loading.
Each of the WKWebView's contains a chart rendered via javascript so the load time takes about…

TWilly
- 4,863
- 3
- 43
- 73
2
votes
1 answer
Async tasks in a for loop
I have three methods that I want them to execute like follows:
+(void)method1{
// Some code
dispatch_async(dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
for (int i=0; i

androniennn
- 3,117
- 11
- 50
- 107
2
votes
3 answers
iPhone App Crashes with dispatch_async if operation is not completed
In my shipping iPhone App, I've used a dispatch_async block without issues. The App checks a web site for price updates, parses the HTML, updates a Core Data model accordingly, and then refreshes the table being viewed.
In my latest App however,…

Slowburner
- 183
- 3
- 11
2
votes
1 answer
dispatch_async does not Work all the Time
I have the following code...
-(void) SetSerialNumber
{
NSLog(@"SetSerialNumber");
NSString *serialNum = textFieldSecond.text;
if (textFieldSecond.text == nil) {
[self performSelectorOnMainThread:@selector(display:)…

jxgn
- 741
- 2
- 15
- 36
2
votes
2 answers
dispatch_async never finishes executing entire block
I'm new to GCD, and what seems to be a simple use of it doesn't work for me. I have the following code:
+ (void)synchronizationTimerFired:(NSTimer *)theTimer
{
if ((synchronizationUpNeededFlag) || (synchronizationDownNeededFlag))
{
…

John Bushnell
- 1,851
- 22
- 29
2
votes
2 answers
How does a serial dispatch queue guarantee resource protection?
//my_serial_queue is a serial_dispatch_queue
dispatch_async(my_serial_queue, ^{
//access a shared resource such as a bank account balance
[self changeBankAccountBalance];
});
If I submit 100 tasks that each access and mutate a bank…

user798719
- 9,619
- 25
- 84
- 123
2
votes
2 answers
EXC_BAD_ACCESS on dispatch_async while inserting data into SQLite with FMDB
So, I've read through every posts I found on internet but i still can't seem to make this work.
I'm trying to insert a huge amount of data into sqlite database. It's 20000 rows of data, so I have to do it in the background thread.
I have a…

tyegah123
- 197
- 3
- 13
2
votes
1 answer
Multiple async requests at once in objective c
I have am downloading multiple images from a web server at the same time, and I the problem is they are getting mixed up with each other.
dispatch_async(dispatch_get_global_queue(0,0), ^{
NSData * data = [[NSData alloc]…

Jason Silberman
- 2,471
- 6
- 29
- 47
2
votes
1 answer
should i dispatch web service call to background on ios development
in my app, i need to call a web service to get data (http get). I am a new ios dev, i wonder if i should dispatch the http get call to background, and bring tableview reload data to foreground like the code below? thanks…

trillions
- 3,669
- 10
- 40
- 59