I have the following code...
-(void) SetSerialNumber
{
NSLog(@"SetSerialNumber");
NSString *serialNum = textFieldSecond.text;
if (textFieldSecond.text == nil) {
[self performSelectorOnMainThread:@selector(display:) withObject:@"Please Enter the serial number" waitUntilDone:YES];
return;
}
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT,0), ^(void){
NSString* response;
[self performSelectorOnMainThread:@selector(display:) withObject:@"Sending Set Serial Num request" waitUntilDone:YES];
[[testApp sharedClass] SetSerNumber:serialNum];
[self performSelectorOnMainThread:@selector(display:) withObject:@"Waiting for Response..." waitUntilDone:YES];
response = [[Process sharedProcess] readAndProcessData:ACK];
[self performSelectorOnMainThread:@selector(display:) withObject:rpcresponse waitUntilDone:YES];
});
}
The method display:
puts the message onto a UITextView
.
I call this function when a button is pressed. Sometimes the dispatch_async block is not being called. Its just falls through it. However, I can see the log message printed every time.
Can anyone please share what might cause this?