Pergunta de entrevista da empresa Apple

Is there a difference between performSelector and performSelector:withDelay of 0?

Respostas da entrevista

Sigiloso

26 de jan. de 2016

Calling performSelector will call that function synchronously. Calling performSelector:withDelay: of 0 will perform that function on the next run loop.

2

Sigiloso

26 de jul. de 2015

Yes. The difference is when the selector is executed. performSelector executes the selector immediately whereas performSelector:withDelay of 0 does not, as you can see from apple's documentation: "Specifying a delay of 0 does not necessarily cause the selector to be performed immediately."