Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

mdhansen5

macrumors member
Original poster
Nov 22, 2010
43
0
Colorado
I'm using a core data, NSFetchedResultsController UITableView, with a transient NSDate attribute. The main reason I have this as a transient property is so my UITableView entries get put into sections based on NSDate, but can move between the sections when the date changes.

So far it seems to work great, but it only updates/refreshes (I'm really new to this, so I don't know if I'm using the correct terminology, sorry!) when I either close the app and kill it from multitasking, or re-run it through Xcode. If I don't do that, the items don't change and aren't put into their correct sections. Is there a way to manually get it to refresh so the user doesn't need to do that to get it to run right?

Thank you!
 
I'm using a core data, NSFetchedResultsController UITableView, with a transient NSDate attribute. The main reason I have this as a transient property is so my UITableView entries get put into sections based on NSDate, but can move between the sections when the date changes.

So far it seems to work great, but it only updates/refreshes (I'm really new to this, so I don't know if I'm using the correct terminology, sorry!) when I either close the app and kill it from multitasking, or re-run it through Xcode. If I don't do that, the items don't change and aren't put into their correct sections. Is there a way to manually get it to refresh so the user doesn't need to do that to get it to run right?

Thank you!

It sounds like you are not saving your managedObjectContext.

After you update one of your entity's date attribute, save the managed object context.

Code:
NSError * error = nil;
[your_entity.managedObjectContext save:&error];
 
Transient properties don't save to the persistent store. That is the point of them being transient, your saying to the store don't bother saving this data i can recreate it as needed.

There are a couple of ways to recreate them. One which might be simplish is to create a sub-class for your Entity. Then you can overwrite the
-awakeFromFetch
method to repopulate the transient fields as the entity gets pulled from the store.

Trying to hunt round for a good tutorial. Will post later if i find.
The other useful method that could be of interest is
-awakeFromInsert
which you could use to set the value went you create the object.
 
Did you try to reload data?

Or do a update to the view such as re-display?

Since your question indicates a change was made but not shown until the app is restarted. This indicates to me you need to add some sort of update to you table view delegate.

The best place to find answers is here, and I've included a thread about a similar problem:
http://stackoverflow.com/questions/17940662/uitableview-not-updating

Stackoverflow.com is the goto place for iOS programming discussions.
 
  • Like
Reactions: ngergo100
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.