Note that there are some explanatory texts on larger screens.

plurals
  1. POUItableview not refreshing updated data from core data
    primarykey
    data
    text
    <p>i have a uitableview with a method fetch list that runs every 5 secs. when there is updated data in the core data for that record, the fetch list method does not update the latest into its array. thus, when i reload the data, it always shows the "old" record. </p> <p>i call this method, followed by a reload data on the uitableview.</p> <p>this is my fetch list method:</p> <pre><code>- (void) fetchList:(int) listNo{ // Define our table/entity to use self.marketWatchListArray = nil; NSEntityDescription *entity = [NSEntityDescription entityForName:@"Market_watch" inManagedObjectContext:context]; // Setup the fetch request NSFetchRequest *request = [[NSFetchRequest alloc] init]; [request setEntity:entity]; Mobile_TradingAppDelegate *appDelegate = (Mobile_TradingAppDelegate *)[[UIApplication sharedApplication] delegate]; NSPredicate *getList = [NSPredicate predicateWithFormat:@"(list_id == %d) AND (userID == %@)", listNo, appDelegate.user_number]; [request setPredicate:getList]; NSSortDescriptor *sortByName = [[NSSortDescriptor alloc] initWithKey:@"stockName" ascending:YES]; [request setSortDescriptors:[NSArray arrayWithObject:sortByName]]; // Fetch the records and handle an error NSError *error; NSMutableArray *mutableFetchResults = [[context executeFetchRequest:request error:&amp;error] mutableCopy]; if (!mutableFetchResults) { // Handle the error. // This is a serious error and should advise the user to restart the application } // Save our fetched data to an array [self setMarketWatchListArray: mutableFetchResults]; [mutableFetchResults release]; [request release]; </code></pre> <p>}</p> <p>strange thing is the table does not update with the latest when the timer runs fetchlist:1. When i swap to fetchlist:2, then back to fetchlist:1, the table is updated with the latest. </p> <p>I have a segmentcontrol to toggle between different list.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload