core-data

Application Will Terminate Notification & Saving Drafts (Core Data)

Hi there, If the user is currently in my edit view controller, I want to be able to save the changes when the user closes my app. To do this I am observing the UIApplicationWillTerminateNotification of the shared application. In my app delegate, I use the applicationWillTerminate: method to close things down and release all my core data...

NSPopupButton, updates depending on another NSPopupButton

Hi all, I wish to make a city/country selector using 2 NSPopupButtons. One popup button will contain the first part e.g. UK, and the second one will contain the second part e.g. London So the whole city/country combo will read: UK London however, I want the second part to be updated when the first part is selected, e.g. if London is sel...

Core data not saving images iphone app

If i do the following it saves fine: - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)selectedImage editingInfo:(NSDictionary *)editingInfo { box = (Box *)[NSEntityDescription insertNewObjectForEntityForName:@"Box" inManagedObjectContext:managedObjectContext]; // create an instance ...

iPhone coredata fetch request, basics around relationships and sections

Hi all, I've got what is hopefully a simple question - I've got two entities - List and ListItem - and there's a one-to-many relationship set up between them, all good. My problem comes when I'm trying to perform a fetchrequest which will return the listitems sectioned up by an attribute of the listitem. I can't perform a fetchrequest...

CoreData: Storing (and sorting by) a vector of floating point numbers

I am building an application using CoreData which will require me to store an array of floating point numbers against instances of an Entity, and then fetch a selection of these entities in order of the (say) manhattan distance between their respective matrices. Here is a rough diagram of something like what I mean: Entity: { name: '...

Saving to Core Data with NSMutableArray

Hi all! Been having a bit of a headache with this one and was wondering if someone could offer some advice! Im implementing persistent storage with Core Data. I have two Entities Car and Driver. A car can have many drivers. In one view i am collecting the drivers and storing them to a NSMutableArray This array is getting passed to...

CoreData - how much is done to maintain relationships automatically

I wonder if I've been doing too much myself, and could be relying on CoreData more. Suppose I have two managed objects, Dog and Tail, which have a one-to-one relationship. Dog has a relationship, tail, that is optional. Its inverse is owningDog. The delete rule from Dog to Tail is cascade. Tail's owningDog relationship is also optional. ...

Tableviecells are not getting deallocted.....Memory Management issues.

hi... I am working on an application in which uitableviewcells of uitableview are customized which contains a textfied(contains managedobject/core data), label((contains managedobject), buttons so all are customized. i am creating uitableview dynamically using sqlite. Similarly uitableview view contains more than 15 cells. Cells are d...

Combine two core data applications! Iphone

Hello all, Just preparing myself for a task that i feel could be quite troublesome, and just wanted to get any advice or pointers on where i may fall over with this task. I have two "mini" applications, they both use core data as a persistent storage solution. I am going to combine these two apps to make a "Medium" sized app :) Is th...

Pre-load existing data into a Core Data-based iPhone app?

In a previous project, I built an iPhone app for 2.2.x that used SQLite. It had existing data (in XML form) that needed to be pre-loaded into the build. So I wrote a small tool which used libxml2 to parse the XML, and then write out an SQLite database, which then was included directly in the build as a resource. This worked out great. I...

Memory usage accounting in a navigation controller-based app;

I have a navigation controller-based application that could be active for a relatively long time and can load multiple screens, revisiting some in the course of its life - a business application. When I push a screen I allocate some memory; when I go back (pop it) I need to ensure memory is not lost. Now in Leaks I have a clean slate. N...

One to Many relationships iPhone - NSPredicate core data query

I have a have a number of calendars, which each have a number of events. I would like to find all the events for a calendar where date > x. My method signature looks like this -(NSArray*)eventsForCalender:(Calendar*)calender StartDate:(NSDate*)start endDate:(NSDate*)endDate; I added an Event to a calender like this, but I don't have ...

Cocoa Core Data and Tab View - How do I tell when Tab View is finished "loading" so I can tell the view to initialize itself?

Hi, I have a simple Core Data app I am building to try to understand Core Data. It has two entities: a weather station, and a collection of observations for a given station. I created the initial interface for this by putting a tab view on my window, selecting the first tab, and dragging the weather station entity onto that view; then s...

Displaying data from multiple entities in a single NSTableView (Core-Data)

Hi there, I have an entity called Pupil, and an entity called Loan. The Pupil entity has the attributes: firstName, lastName, address, postCode, telephoneNumber. The Loan entity has the attribute: loanID, and the relationship: pupilID, which is a relationship to the entity Pupil. I wish to display the loanID, with the pupil (if any) re...

iPhone Core Data - restrict returned results to future events

Hi, I have a data store of events, however I only want to show events that occur in the future. I have a field denoting the date of the event of type NSDate. How do I filter events that have an NSDate * date time in the past? Thanks NSFetchRequest *request = [[NSFetchRequest alloc] init]; NSEntityDescription *entity = [NSEntityDesc...

Core Data Migration error message "'Model does not contain configuration 'XYZ'.'"

I have a Managed Object Context to which I add two different SQLite stores. I use Configurations in the Mananged Object Model to assign certain entities to one store and other entities to the other. The Configurations are called "UserDB" and "MainDB". Everything works okay until I try to use automatic migration. After creating a new Man...

How to optimize Core Data query for full text search

Can I optimize a Core Data query when searching for matching words in a text? (This question also pertains to the wisdom of custom SQL versus Core Data on an iPhone.) I'm working on a new (iPhone) app that is a handheld reference tool for a scientific database. The main interface is a standard searchable table view and I want as-you-t...

Does re-fetching NSFetchedResultsController do anything?

I have a fetched results controller with a predicate on my Thing entity that looks like this: "thingDomain.domainCurrentAccount !=NULL". It finds all of my Thing objects that are in the current domain. The current domain is defined by a one-to-one relationship between the Account entity and one of the Domain entities. Each Thing belongs ...

Crash when moving a row in UITableView

Here is the exception: Serious application error. Exception was caught during Core Data change processing: *** -[NSCFArray removeObjectAtIndex:]: index (0) beyond bounds (0) with userInfo (null) Here is the relevant code: - (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSInde...

How to write a Core Data predicate to filter to specific sub-entity types?

I have a superentity called FObject with several subentities, say Foo1, Foo2, and Foo3. I have a number of tableviews that should show information about different collections of the subentities, so for example, one shows only Foo2s and Foo3s while another shows all of them. How do I write a predicate to filter on the subentity type, giv...