core-data

CoreData save does no persist over app lifestyle

Hi, I got a strange issue. I am inserting a new object into my Core Data database. I can make request over all my datas but when I close the application and launch it again all my datas are gone ... With iPhone 0S 3 I haven't got this problem, but now with iOS 4 ... Someone have an idea? ...

Starting point in learning Core Data on iPhone?

What is the starting point for Core Data in order to get involved quickly? Any useful link, blog or book or other resourse? ...

Validation with multiple UITextFields

Hi, I would like to create a UIView has multiple UITextFields validates each one as the user is done editing it. The view controller is the delegate for each of the UITextFields. When a user changes a value in one of those UITextFields and either touches "done" on the keyboard or touches on another one of the textfields in the view, I...

Determining if an NSDate is today in NSPredicate

I've tried multiple methods and tried some suggestions on this site, but how can I determine if a CoreData attribute "dueDate" is equal to "Today", I know NSDate is a specific time as well but I want the predicate to return if it is the same day/month/year regardless of what the time is in the day. Any suggestions? ...

"On duplicate key update" for core-data

Hi, I would like to know if there is some kind of similar functionality or way to preform an "on duplicate key update" function with core-data as there is with MySQL. What I want to do is to save an object to the database every time a user presses a button. But if the button is already pressed I want to update the row with some new val...

Proposed solution to NSTreeController displaying duplicate enitities

As many of you may know, an NSTreeController bound to an outline view can display duplicates while presenting core data entities. A temporary solution is to add 'parent == nil' to the predicates, but this only returns parent entities. If, for instance, a user is searching for a sub-entity, the requested sub-entity won't be displayed. ...

CoreData: returning a set of entities in a single fetch that match an array of nsnumber indexes

So I want to fetch a varying number of entities that match randomly generated index numbers that are associated to the entity. So i get a count of entities in a given set and i generate a random collection of nsnumbers within that range. now i need to pull out the entities whose index match those generated numbers ideally in a single fe...

NSFetchedResultsController index beyond bounds

I'm using an NSFetchedResultsController to display items in my table view: - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { // Return the number of sections. return 1; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { // Return the number of rows in the section....

Fetched properties as properties of an NSManagedObject subclass

I have a subclass of NSManagedObject (NSMO) called Team. Team has a one to many relationship with another NSMO subclass called Contract. Contract has a 1-to-1 with Player (another NSMO). I would like to simplify my code that uses Team and be able to just refer to its "players". Players will just be an array of players that have a contrac...

How to make/use temporary NSManagedObjects?

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...

Fill CoreData ManagedObject property based on another object property

I have app that stores tree structure in CoreData. There is an ManagedObject, "Item", and it has attributes: itemId (string) List item title (string) parentId (string) parent (relationship to Item) parentTitle (string) parentId points to another Item object. How do I make property parentTitle to be filled automatically with title...

Passing managedObjectContext along to view/controller hierarchy

Managed object context in most cases created in application delegate. What are the ways of passing it along to view/controller hierarchy, so every navigation/tab controller in the tree can have access to it. Passing it every time from parent to child may not be the best since I have to carry this information every time and sometimes not ...

Coredata integration into existing application problem iphone

Hi all, I'm integrating coredata into my existing application as given in http://wiresareobsolete.com/wordpress/2009/12/adding-core-data-existing-iphone-projects/. I'm facing a problem in insertion of data. My data isn't getting inserted into the following entity. I'm importing coredata framework into the class Editorial. @interface ...

Objective C tree data stucture with Core Data support?

I am looking for some reference work or tutorial of a persistent objective-c tree? I am trying to build a family tree (genealogy records) app on iPhone / Mac OS. Thanks! ...

Why CoreData crashes with "unrecognized selector" when I try to set a relationship?

I have simple tree structure in one CoreData entity called "Item". Any item can be parent of another item and can have multiple children. There's following relationships in the entity: childItems: To-Many, Destination: Item, inverse: parentItem. optional parentItem: Destination: Item, inverse: childItems. optional I am using Xcode-ge...

NSFetchResultsController iOS4

I'm only getting this error in my app since upgrading to ios4. newsDetailController.news = (News *)[self.fetchedResultsController objectAtIndexPath:indexPath]; NSLog(@"\n Indexpath of details news before pass = %@", [self.fetchedResultsController indexPathForObject:newsDetailController.news]); Basically, this: [self.fetchedResultsCon...

iPhone Core Data updating records

I'm trying to find a solution to what I think has to be a simple problem. I'm using coredata to maintain a list of bookmarks in my app. there are only three fields being stored, bid, order and title. in some cases I want to update an existing record. currently I'm using a predicate to search for a particular bid. the problem I'm h...

Loading all the values of an attribute of core data to an array

I have an attribute "term" which is a NSString in my core data "Event". When the table view is loaded I want all the values of "name" to be loaded to an array. I used the code - (void)configureCell:(UITableViewCell *)cell atIndexPath:(NSIndexPath *)indexPath { Event *event = nil; event = [fetchedResultsController objectA...

Getting a count of records in a core data entity

Anyone know of an existing function or property that provides a count of the records in a core data entity that I'm missing in the docs? Any help appreciated Thanks // :) ...

Prevent duplicates when importing RSS feed to Core Data

Trying to import a RSS feed into Core Data. Once they are imported, when trying to update the feed again afterwards, how do I most efficiently prevent duplicates. Right now it checks every item against the datastore during the parsing, which is not very efficient. I looked into the Top Songs sample from Apple. It uses a least recently u...