lets have one scenario as follows,
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
// Doing some DB operation or Server call
// After getting result i am making UI update in main thread
[self performSelectorOnMainThread:@selector(myMethod) withObject:nil waitUntilDone:YES];
});
or
calling perform selector in background from a method like,
- (void)callingWSMethod {
[self performSelectorInBackground:@selector(myMethod) withObject:nil];
}
- (void)myMethod {
// Doing some DB operation or Server call
dispatch_async(dispatch_get_main_queue(), ^{
// After getting result i am making UI update in main thread
});
}
Can i combine performSelector and GCD ?
Are the above both types of making background thread and main thread call will give the same result? Thanks.