Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get a return value from a function which is called through NSthread?

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

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

How to get a return value from a function which is called through NSthread?

like image 283
muhammed basil Avatar asked Apr 15 '12 11:04

muhammed basil


1 Answers

The "return value" shouldn't be returned by the method, but it should update a class iVar and notify whoever was waiting for the object that it is now ready (by notify I don't necessarily mean NSNotificationCenter). Good luck.

like image 73
Stavash Avatar answered Sep 22 '22 01:09

Stavash