Pergunta de entrevista da empresa Apple

1. What is the difference between Grand Central Dispatch, NSThread, and NSOperation and when would you use each?

Resposta da entrevista

Sigiloso

16 de jul. de 2015

All three are methods of multithreading on iOS or OSX. NSOperation is typically my preferred approach because it is the most high level and allows for cancelation and dependencies. NSOperation uses GCD under the hood. I typically don't use GCD directly anymore expect for things like singletons using dispatch_once. NSThread is pretty old school and is mainly used today for checking which thread you're running on for debugging.