multithreading - iPhone - is ASIHTTPRequest threadsafe? -


i have method:

-(void)updatesomething {    nsautoreleasepool *pool = [[nsautoreleasepool alloc] init];    nsurl *url = [nsurl urlwithstring:@"some url"];     asiformdatarequest *httprequest = [asiformdatarequest requestwithurl:url];    [httprequest startsynchronous];    //some other stuff    [pool drain]; } 

i call method onapplicationdidfinishlaunching if call on main thread works fine

[self getmyitems]; 

but when call on separate thread "program received signal: "exc_bad_access"

[self performselectorinbackground:@selector(getmyitems) withobject:nil]; 

any idea how resolve issue?

why perform individual requests on separate threads when can use asinetworkqueue?

asinetworkqueue *aqueue = [[asinetworkqueue alloc] init]; [aqueue addoperation:requesttoadd]; [aqueue setdelegate:self]; [aqueue setrequestdidfinishselector:@selector(requestfinished:)]; [aqueue setrequestdidfailselector:@selector(requestfailed:)]; [aqueue setqueuedidfinishselector:@selector(queuefinished:)]; [aqueue go]; 

asinetworkqueue subclass of nsoperationqueue , asi*requests run on separate threads.


Comments

Popular posts from this blog

Python __call__ special method practical example -

How can I edit my VIM config so that Vim treats ".ejs" files the same as it currently treats my html files? -