TTURLResponse - nil

I am trying to implement simple TTURLRequestin my application. I am new to Three20 structure. Basically I want to TTURLRequest, and TTImageViewfor the amazing cache.

My delegate has the following code:

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

responsealways zero. I cannot understand what I am doing wrong. I looked in the application support directory and created a cache file with the relevant data, so I know that it received a response. What am I doing wrong?

+3
source share
2 answers

Debugged code - you really need 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];

You might think that the request will be responsible for creating the response, but Three20 stuff does not.

+6

revetkn.com TTURLRequest.

, , Three20../( ). : http://revetkn.com/?p=72

0

Source: https://habr.com/ru/post/1717978/


All Articles