Skip to content
Browse files

fix for processing already processed reviews if more than 20 new revi…

…ews exist
  • Loading branch information...
1 parent 955c349 commit d3763312dc79cd0a7054b8a6d03102f0d0401833 @jonkean committed Sep 18, 2011
Showing with 8 additions and 2 deletions.
  1. +8 −2 Classes/ReviewDownloadManager.m
View
10 Classes/ReviewDownloadManager.m
@@ -136,15 +136,21 @@ - (id)initWithProduct:(Product *)app storeFront:(NSString *)storeFrontID country
productObjectID = [[app objectID] copy];
psc = [[[app managedObjectContext] persistentStoreCoordinator] retain];
storeFront = [storeFrontID retain];
- data = [NSMutableData new];
page = 1;
+ backgroundTaskID = UIBackgroundTaskInvalid;
}
return self;
}
- (void)start
{
- backgroundTaskID = [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:nil];
+ NSAssert(canceled == false, nil, nil);
+ // method may be called by connectionDidFinishLoading, and don't want to clobber the existing taskID
+ if (backgroundTaskID == UIBackgroundTaskInvalid) {
+ backgroundTaskID = [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:nil];
+ }
+ [data release]; // release fields from potential previous page downloads
+ data = [NSMutableData new];
NSString *productID = _product.productID;
NSString *URLString = [NSString stringWithFormat:@"http://itunes.apple.com/WebObjects/MZStore.woa/wa/customerReviews?s=%@&id=%@&displayable-kind=11&page=%i&sort=4", storeFront, productID, page];

0 comments on commit d376331

Please sign in to comment.
Something went wrong with that request. Please try again.