Hi folks,
Here is my code that is being run in a background thread:
-(void)updateFAQCache {
NSAutoreleasePool *objPool = [[NSAutoreleasePool alloc] init];
// Grab the new plist
NSMutableArray *arrLoadedData = [[NSMutableArray alloc] initWithContentsOfURL:[NSURL URLWithString:@"http://myurl.com/"]];
// If the data is not Nil, update the table view and cache with the new data
if (arrLoadedData != Nil) {
// Merge the new data into our IVar
arrFAQData = arrLoadedData;
// Update the table view
[self performSelectorOnMainThread:@selector(refreshFAQTable) withObject:Nil waitUntilDone:NO];
// Save the new data to the cache
[arrFAQData writeToFile:self.strFAQCacheLocation atomically:YES];
}
[arrLoadedData release];
[objPool release];
}
My issue is that it seems the contents of arrFAQData
is being released when arrLoadedData
is released. This DOES makes sense to me, but I need to figure out how to retain this data into my IVAR while allowing me to release the local variable, arrLoadedData
?
Thanks for your help!