In IPhone How to use multithreading with static methods in NSThread
I an developing an iPhone application in that,I am trying to download multiple files simultaneously from ftp server with threads.but my method to download is written in header file and that method is static.so if i try to access that method with to threads then variables of method for fir开发者_StackOverflow社区st thread are overridden by variables of first thread.Please suggest me how to synchronize the two threads in this case.
I was suffering from the same problem and i solved it by using code like this
Where you are telling the target for dedatching the method to thread you should use [Myclass class]
Example:
[NSThread detachNewThreadSelector:@selector(startSpinner) toTarget:[MyappDelegate class] withObject:nil];
Hope this helps.
精彩评论