Any idea why
//should save the object context.
NSError *error;
if (![managedObjectContext save:&error]) {
NSLog(@"SAVE ERROR");
}
when implemented in a view controller(accessed via a drill down tableview) won't properly save the information? I am passing the moc from the beginning (rootview hands off to tableview, tableview r...
Hello,
I don't understand the output of NSLog for the array returned by a NSFetchRequest.
I'm reading my database and placing the contents in an array, looping through the array and then outputting the contents with NSLog. I don't quite understand the output in the log file. Code below:
-(void)createXMLFeed{
//Fetch details from ...
I would like to use a single NSManagedObject subclass to represent an item. However, much of the time, the items I will be representing are fleeting, and are not to be saved to the persistent store. It seems like an in-memory store would be the correct setup.
However a few times the user can choose to 'save' an item, and thus I would th...
You have to have one per thread, but beyond that ... should you have more? Is it harmful to have more?
For instance, I'm tempted to build my app around having one NSManagedObjectContext per tab, handling the subset of the overall persistent store that appears on that particular tab.
That way, I can have the tab GUI listen to notificata...
Why would I be getting a different instance of HistoryViewController than the one I instantiated and pushed onto the navigationController?
The different instance created doesn't have any of the properties I've set.
ProfileHomeViewController.m
HistoryViewController *historyViewController = nil;
historyViewController = [[HistoryViewCon...
Simple, common pattern I can't find in Apple's docs:
Load a coredata store
Download new data, creating objects
in memory
Save some of the new data to the
store (usually "only the new bits / bits that haven't changed")
Instead, I can find these alternatives, none of which are correct:
Don't create objects in memory
(well, this means...
Hi, after I insert a ManagedObject into a context I'd like to fetch it later but before saving the context (I'd save after all objects are inserted). It appears that querying the context later with a fetch concerning those objects returns nothing if the context wasn't previously saved.
Is there a way to save only in the end ?(I guess i ...
I have this code:
NSEntityDescription *userEntity = [[[engine managedObjectModel] entitiesByName] objectForKey:@"User"];
User *user = [[User alloc] initWithEntity:userEntity insertIntoManagedObjectContext:[engine managedObjectContext]];
and I want to know the id of the object inserted to the managed object context. How can i get that?...
I am trying to pass a managedObject from a mapView with multiple annotation to a mapDetailView with only one annotation of the managedObject passed. This works great in a tableView to mapDetaiView. Any help would be appreciated. My code ...
- (void)viewDidLoad {
[super viewDidLoad];
if (self.managedObjectContext == nil) {
self.man...
I a, working on coredata iphone TabBar app and passing appdelegate managedObjectContext to all the views and subviews.At some instance i need to create new record for entity A and while entity A didn't saved by the user i need to create another entity B by using the same shared context. Now, my problem is if i save the context for entity...
I was wondering if there is a way to share an NSManagedObject between two or more NSManagedObjectContext objects running in the same thread.
I have the following problem: I have one main context shared through all my code in the application and several different contexts that are created for each remote fetch request that I issue. (I c...
Hi everybody, I need to understand something about NSManagedObjectContext update.
I have a UISplitView with a UITableViewController on the RootView and a UIViewController on the Detail View. When I tap in a row with data, I load some data into labels and a UITextView where I can update that field:
- (void)textViewDidEndEditing:(UITextVi...
I am using core data in my iPhone app. I have created a simple class Friend, which derives from NSManagedObject and which uses the following property:
@property (nonatomic, retain) NSString *name;
I am able to add and delete instances of this class to my context and my changes are persistent also.
Now I want to update/modify a Friend-...
Im a creating an app for my iPhone using coredata.
I have a viewcontroller with an object i want to save that object to my FavoriteViewController.
By clicking a button favorite I want my object to be save into the managedObjectContext but I'm getting the following error:
Terminating app due to uncaught exception 'NSInternalInconsisten...
I have some trouble with a core data project. I have a NSArrayController with NSManagedObjects in it, and + / - buttons. If i delete a object in the row after the file has been saved it works perfectly, but if I add a new object, and immediately delete it again (without changing any of the default values), i get an error:
Serious appli...
The setup:
I have two managed contexts setup (on an iPhone application). A main context that I use for most queries and a background context I use for long running operations that I want to happen in the background.
I've setup notifications for NSManagedObjectContextDidSaveNotification against each managed object context. In response t...
In my iPhone app, I have an NSFetchedResultsController showing User objects in a UITableView. The User Objects have 0-many Log objects. A summary of the Log objects are shown together with their User object in the UITableView.
My app uses a tab bar, so user input in the logging tab require that the user tab's NSFetchedResultsController ...
Original question has been answered. Update addresses related question raised in comments.
Original post:
I am using the MOC save method used in Apple's CoreDataBooks. However, I seem to have use for two layers of MOC merging (three MOCs where the 3rd merges with the 2nd and then the 2nd merges with 1st).
First, I have a tableview (Cl...
Hi,
I try to delete some managedobjects by calling in a for loop
[managedObject delete];
and at of the loop, I call
[managedObjectContext save:nil];
At the above line, the app crashes and goes nowhere from there. Any ideas?
Thanks
...
Hi everybody,
I am a novice in Objective-C; and I could not find any solution in my Books or internet.
My question: What are the most efficient and fastest ways to use already compiled .mom and SQLite db without having the source codes?
Details:
I am trying to connect my small app to the database of another application and use (read-in...