Reputation: 1834
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?
Upvotes: 6
Views: 756
Reputation: 14304
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.
Upvotes: 1