Using the new TWRequest iOS 5 API, I came across a brick wall associated with using blocks.
What I need to do is get a successful response to the first request, immediately launch another. In the completion block of the second request, I notify of a successful or unsuccessful multi-step action.
Here's roughly what I am doing:
- (void)doRequests { TWRequest* firstRequest = [self createFirstRequest]; [firstRequest performRequestWithHandler:^(NSData* responseData, NSHTTPURLResponse* response, NSError* error) {
I do not save any of the requests or keep links to them anywhere; it's just fire and forget.
However, when I run the application, it is reset using EXC_BAD_ACCESS on:
[secondRequest performRequestWithHandler:...]
It makes the first request just fine, but when I try to start the second with a handler, it will work. What is wrong with this code?
The ways to create queries are simple:
- (TWRequest*)createFirstRequest { NSString* target = @"https://api.twitter.com/1/statuses/home_timeline.json"; NSURL* url = [NSURL URLWithString:target]; TWRequest* request = [[TWRequest alloc] initWithURL:url parameters:params requestMethod:TWRequestMethodGET];
source share