core-data

UITableView reordering core data results

my UITableView is reordering the results after you navigate away and them come back to the view. it only does it one time though - if you navigate away and then come back a second time the new order doesn't change. does anyone know what could be causing this? thanks for any help. ...

ManagedObjectContext seems to change after save and can't be changed by some other ViewController

Hi all I have a MOC created in my AppDelegate class. I have a MOC property in my RootView which is set by the AppDelegate with something like: rootView.managedObjectContext = self.managedObjectContext; This rootView creates at some time a ModalView and sets there a MOC property also by the same way. Everything works fine. I can crea...

iphone core data deletion causes a crash

Hi, I have a core-data object "entity" with 2 fields - "name" (a NSString *) and "type" (a EntityType). EntityType is another core data obect with 1 field - name (NSString *). I am creating and deleting an entity object using the code similar in functionality to the following code - Entity *e1 = [NSEntityDescription insertNewObjectFor...

Implementing incremental search on iphone

I have alot of data stored locally (10000+ data records) (not decided on how yet - this is part of the question) How may I implement incremental search on this data (on a specific field)? How should I set up the data locally? XML? plist? sqlite? Should I use Core Data for access? ...

What am I doing wrong with NSManagedObjectContext dependency injection?

I am trying to use NSManagedObjectContext dependency injection as recommended by Marcus Zarra -- I'm creating an M.O.C. in my AppDelegate and passing it as a retained property to each of my view controllers. Generally this seems to work well, but in a modal table view controller that presents data via an NSFetchedResultsController, I on...

Crashing core data application.

Hi, I have setup my first core data project. Everything works fine until I do the following (in Simulator/Device): • Close App using "Home Button" • Double press "Home Button" and quit the app from background. • Reopen the app As soon as it reopens there is an instant crash with nothing in the log. The last thing logged is "Program ...

Problem with one-to-many NSPredicate in NSFetchedResultsController

Lets say I have a core data model like this one: Item attributes: name type relationships: properties Property attributes: name value realationships: item Each Property is connected to one Item, and each Item many properties. One Property may look exactly the same as another. I know the value of one Property and want to get the ...

Changing the sortDescriptor of a FetchedResultsController dynamically. Ideas?

I'm having difficulty understanding how to update my fetchedresultscontroller with a new sort. I initialize a frc the standard way in my class. But how exactly do you modify the fetchrequest with a new sortdecription? My app has a sort selector in the appSettings that the user can change on the fly. Is there a way to update the frc dyn...

Core Data : Keypath name not found in entity

Hello, I'm crashing with this message : 'NSInvalidArgumentException', reason: 'keypath name not found in entity Obvisouly I'm not querying my entity correctly . //fetching Data NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init]; NSManagedObjectContext *context = [(AppDelegate *)[[UIApplication sharedApplication] delegate...

Error when Saving Core Data sqlite in NSPersistentDocument

Hi! I have small COCOA Mac OS application to play with core data. I have overridden default save function to do extra job after saving document (automatically save a zip copy also). Every time I save - program crashes with EXC_BAD_ACCESS in line where I call [super writeToURL ...] The good part is - document is being saved properly. He...

Core Data : "insertNewObjectForEntityForName" question

Hello, I'm trying to use "insertNewObjectForEntityForName", but I've got a problem with my declaration, I wondered if someone had an opinion on this . This is my implementation : NSManagedObjectContext *context = [(AppDelegate *)[[UIApplication sharedApplication] delegate] managedObjectContext]; // Create Object Shots *newShot = (Sho...

NSArrayController Class vs Entity mode in Core Data Mac OS X document based application

Hi! Can anyone explain differences in practise between NSArrayContoller modes (Class / Entity}? I am just facing some debugging issues in my document based Core Data desktop application (using Entity mode for all my controllers). My database structure became quite complicated and it takes so much time to find wrong bindings (mistyped k...

Core Data: Fetch via specific property (join relationship)

I have an core data model as follows The attributes property of Page is a set of DictionaryEntry, they are values for my Page objects, much like a standard NSDictionary (except all of the keys and values are strings) I have a Page that has a DictionaryEntry with key="title" and value="Home". How would i form a fetch request to load t...

NSManagedObject and KVO vs Documentation

I have a custom NSManagedObject subclass, say, Person. I also have a UIView registered with -addObserver:forKeyPath:options:context: to observe various properties of a Person, some of which are persistent like "name" and others are just dumb KVO-compliant accessors unrelated to Core Data, like "drinking". @interface Person : NSManagedOb...

Core Data - Count of Related Records

Hello all, I am new to Core Data programming and am trying to work out the concepts involved. I have an object called a Lease that has a many-to-many relationship with Apartment objects. Given a Lease object, how do I get a count of the related Apartment objects or an NSArray of the related objects? Thank you! ~~Garth ...

Debugging COCOA Core Data bindings

Hi! In my document Core Data application I receive crash with report in console: Cocoa Bindings: Cannot create NSSet from object <_NSControllerObjectProxy: 0x26acb0> of class _NSControllerObjectProxy I have -NSBindingDebugLogLevel 1 startup vargument enebled and I get only this. Is there any way to get more information which class or ...

Cocoa Core Data: Setting default entity property values?

I know I can set default values either in the datamodel, or in the -awakeFromInsert method of the entity class. For example, to make a "date" property default to the current date: - (void) awakeFromInsert { NSDate *now = [NSDate date]; self.date = now; } How though can I make an "idNumber" property default to one greater than the prev...

Core-Data: how to save an object twice in one relationship.

Hi there, say i have NSManagedObject A, that has a many-to-many relationship to NSManagedObject B. I have one saved instance of A and B. (not yet related) Now I want A to save the instance of B twice in its relationship, which is of course a set. Though, since its a set it stores only one reference of B. see: (not syntax checked) NS...

option drag entity of data model to interfacte builder don't work

Hi, These are the steps i make: I create a simple data model of one table with two propertys. Then I compile the datamodel, and then i build the project. Then i make a new xib file with a view then i drag my entity with the option key to the view and i see a + symbol. Then i let my mouse go and nothing happens.... What am i doing wron...

Quick CoreData question -- inverse delete rules

Quick simple question. Apple's CoreData docs explain how delete rules work on a department's employees relationship. Delete a department, and various different things can happen to the associated employees. But what about an employee's department relationship? Should I set my delete rule to No Action, since I don't want the deletion ...