Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TTURLResponse is nil

Tags:

iphone

three20

I am trying to implement a simple TTURLRequest in my app. I'm pretty new to the Three20 framework. I mainly want TTURLRequest and TTImageView for the awesome caching stuff.

I have the following code in my delegate:

- (void)requestDidFinishLoad:(TTURLRequest*)request {
    TTURLDataResponse *response = request.response;
    // Stuff to process response.data
}

response is always nil. I can't figure out what I'm doing wrong. I looked in the Application Support directory and it's creating the cache file with the proper data, so I know it's getting a response. What am I doing wrong?

like image 404
Sam Soffes Avatar asked Jan 28 '26 14:01

Sam Soffes


1 Answers

Debugged your code - you actually have to create a response object and add it to the request before sending your request:

NSString *url = @"http://twitter.com/statuses/user_timeline/samsoffes.json?count=1";
TTURLRequest *theRequest = [[TTURLRequest alloc] initWithURL:url delegate:self];
theRequest.response = [[[TTURLDataResponse alloc] init] autorelease];
[theRequest send];

One would think the request would be in charge of creating the response, but the Three20 stuff doesn't.

like image 84
Steve Brewer Avatar answered Jan 31 '26 04:01

Steve Brewer



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!