How to get return value from function called via NSthread?

I wrote a function that returns an object. But this is a function that takes data from the web.So NSthread is used to call the function.

NSThread* pageThread = [[NSThread alloc]initWithTarget:self selector:@selector(threadFunction) object:nil]; 

How to get return value from function called via NSthread?

+6
source share
1 answer

The "return value" should not be returned by the method, but it should update the iVar class and notify the one who was waiting for the object to be ready (by notifying that I do not necessarily mean NSNotificationCenter). Good luck.

+1
source

Source: https://habr.com/ru/post/913235/


All Articles