سؤال

واني اسعى الى تنفيذ TTURLRequest بسيطة في تطبيقي. أنا جميلة جديدة لإطار Three20. أريد أساسا TTURLRequest وTTImageView عن الاشياء التخزين المؤقت رهيبة.

ولدي التعليمة البرمجية التالية في بلدي مندوب:

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

وresponse هو شيء دائما. لا يمكنني معرفة ما أفعله خطأ. نظرت في الدليل دعم التطبيقات وانها خلق ملف التخزين المؤقت مع البيانات المناسبة، لذلك وأنا أعلم أنه الحصول على رد. ما أفعل الخطأ؟

هل كانت مفيدة؟

المحلول

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.

نصائح أخرى

Mark Allen from revetkn.com posted a datasource implementation for TTURLRequest.

He also posted an example project where he assumes you have Three20 installed at ../ (relative to your project). It's here: http://revetkn.com/?p=72

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top