I’m building an application for iPhone on iOS 7. In the application i fetched accelerometer data, extract features and saved the results as “records”.I have a record database that listed on tableview with another tab. The problem is refreshing the tableview.
After the measure data i tap the list tab and refreshing the tableview but nothing happens. Refreshing is only work when i did several refresh. First i think it’s about saving the data but it’s not. After the getting data if i tapped the list tab first time, all records listed on table view.It works. But If i tapped the tab earlier and i want to see the new record with refreshing, i have to refresh several times. Here is my refresh code:
-(IBAction)refresh{
[self.refreshControl beginRefreshing];
dispatch_queue_t fetchQ = dispatch_queue_create("Reload", NULL);
dispatch_async(fetchQ, ^{
[self getRecordsFromDate];
[self.date.managedObjectContext performBlock:^{
dispatch_async(dispatch_get_main_queue(), ^{
[self.refreshControl endRefreshing];
});
}];
});
}