Implementing Feeds using Three20 Drag to Refresh; Does not update
I'm implementing a Feed Project basically using Three20 Twitter sample as my reference but using my own website's api to get XML response..
I have already functions that will allow myself to post, delete feeds, but when I drag to refresh the TTTableViewController, it does not update the data in the table, what it does is, it goes back to the state where I first loaded the table.
The data 开发者_开发技巧from the first XML response is what I will always get.
- (void)load:(TTURLRequestCachePolicy)cachePolicy more:(BOOL)more {
if (!self.isLoading && TTIsStringWithAnyText(_apiKey) && TTIsStringWithAnyText(_sessionKey)) {
if(more) {
_pageNumber++;
}
else {
_pageNumber = 1;
_finished = NO;
[_feeds removeAllObjects];
}
NSString* url = @"api.mySiteHereWithParameters.com"
TTURLRequest* request = [TTURLRequest requestWithURL: url delegate: self];
request.cachePolicy = cachePolicy | TTURLRequestCachePolicyEtag;
request.cacheExpirationAge = TT_CACHE_EXPIRATION_AGE_NEVER;
TTURLXMLResponse* response = [[TTURLXMLResponse alloc] init];
response.isRssFeed = YES;
request.response = response;
TT_RELEASE_SAFELY(response);
[request send];
}
}
Basically when I drag and refresh, this is called and it goes back down to TTListDatasource and updates the table view, everything else is handled with three20 framework
It's probably a cache issue. I see you're using etags to cache. Does your server support that? It has to be enabled and configured on the server side.
try to use the standard caching:
request.cachePolicy = cachePolicy;
request.cacheExpirationAge = TT_DEFAULT_CACHE_EXPIRATION_AGE;
精彩评论