Tutorial :NSOperationQueue returning __getNextReady bad access on resuming



Question:

Here's how I start the code:

m_searchTimer = [[NSTimer timerWithTimeInterval:0.5 target:self selector:@selector(launchRequest:) userInfo:nil repeats:FALSE] retain];  [[NSRunLoop mainRunLoop] addTimer:m_searchTimer forMode:NSDefaultRunLoopMode];  

then in my -(void)launchRequest method:

- (void)launchRequest:(NSTimer *)timer  {      ASIHTTPRequest *req = [[[m_twitterQueue operations] lastObject] copy];        [m_twitterQueue cancelAllOperations];      [m_twitterQueue addOperation:req];      [m_twitterQueue go];  }  

once I reach the - (void)go; method, I get the bad access.

Any idea is welcomed


Solution:1

I have found the issue.

Using ASIHTTPRequest, there is a @property named

shouldCancelAllRequestsOnFailure //Default is YES

By leaving it on, you add a request while cancelling it which makes the queue crash.

Turning it False solved the issue.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »