views:

29

answers:

1

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

A: 

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.

Pier-Olivier Thibault