core-data

iphone Core Data - What type of proprty for a float?

what type should my property be to work properly with core data float variables. For example in order to get my class to work with int32 in core data i had to create NSNumber in my class. how about the float variables in core data? ...

What is the best way to build a complex NSCompoundPredicate?

I need to build an NSPredicate with many pieces of data. For example in SQL I would do something like the following: SELECT * FROM TRANSACTIONS WHERE CATEGORY IN (categoryList) AND LOCATION IN (locationList) AND TYPE IN (typeList) AND NOTE contains[cd] "some text" AND DATE >= fromDate AND DATE <+ toDate I'm st...

Core data, how to get NSArray of child object's ObjectIDs only?

I have a Core Data object, card, which has a child relationship relatedCards, which references other card objects. I am trying to get Core Data to give me an NSArray of the relatedCards' ObjectID values only—not the other property values for the cards. I know that one option is to run a fetch request such as: Card *myCard = <something> ...

Core data, how to get NSManagedObject's ObjectId when NSFetchRequest returns NSDictionaryResultType?

I have an NSFetchRequest which is returning the objects' properties in an NSDictionaryResultType. Is it possible to also get the objects' ObjectId within this dictionary? Otherwise I will need to run the query with a return type of NSManagedObjectResultType which is much slower for a large number of returned items. ...

How can I get the average value of a column with Core Data?

Hi Guys, If I have the following NSManagedObject, how can I get the average of number1 and number2. @interface Log : NSManagedObject { } @property (nonatomic, retain) NSNumber * number1; @property (nonatomic, retain) NSNumber * number2; Thanks :D ...

Why are some entities NSManagedObjects and some named after their class?

I've noticed that in my Core Data data model, some entities are (in the top-left panel) have a class of 'NSManagedObject' and some are named after a class (Person, Company etc). There doesn't seem to be any logic in whether the entity has a class of NSManagedObject of Person etc. And my code seems to work ok. So I'm wondering why there i...

How do I switch to using Core Data for a simple UITableView instead of an NSArray?

I have an application that uses a UITableView to present data that I have stored in an NSArray. I would like to switch over to using Core Data to host this information to be presented to the table view, but I'm not that familiar with Core Data. I've created a new Core Data database within my project, but I'm lost as to how to proceed ...

Core Data with pre populated sqlite3 file

I'm working on an iPhone app that uses NSURLConnection to down load files and then convert those files into sqlite3 tables. I would like to use core data to store these tables and to create all the applicable objects. So, do I have to build the models of the data in XCode with the graphical tool representing all the table names and colum...

Is the a way to turn off the UITableView delegates temporarily?

I have a UITableView with the usual table view delegates. The problem is that the table is built from core data .. so when my refresh method runs it refills the core data entities. I think this means that the data for the table is unstable, and hence it crashes on a line like this (in 'cellForRowAtIndexPath'): cell.textLabel.text = [obj...

full text search on multiple columns with Coredata on ipad

i use core data in my app. i have 4 columns(id,name,description,specs). I want to full text search across all these columns. Is it possible with core data? If anybody can provide me reference to tutorial or code snippets. Thanks ...

How to pass a managedObjectContext to a second and third view...

I am trying to pass a context from my app delegate to my rootview, then to my secondary view. The secondary view is where all the data is really loaded, the rootview is just a quick synopsis of a few key points. When I instantiate the context in appDelegate i log to check if it is not nil: NSManagedObjectContext *context = [self managed...

Why Core data Needs? How to implement it?

Hi friends, What is the need of Core Data in iPhone development? What are the steps to implement it? What is mean by validating, migration in CoreData? Just explain simple... Thanks in Advance... ...

CoreData Relationships Clarification: How to effectively set an inverse relationship

I have a CoreData relationship set up as follows: (sorry, I'm new to stackoverflow so I have to draw it with ascii). Story (object) Attributes: creationDate, order, Relationships: sentences (one to many with Sentence) Sentence (object) Attributes: image, order, text Relationships: belongsTo (one to one with Story) Notes: t...

NSManagedObject retain count is 2 after creation

I'm wondering if someone could explain why the retain count of a newly created managed object is 2. Here is the code I'm working with: NSManagedObjectContext *context = [self.fetchedResultsController managedObjectContext]; NSEntityDescription *entity = [[self.fetchedResultsController fetchRequest] entity]; Album *newAlbum = [NSEntityDes...

Passing a managedObjectContext through to a UITabBarController's views

I have an app which is based on the Utility template (where you flip over the view to see another). On the first view there is a login screen, then it flips over to reveal a UITabBar style interface. I'm having trouble working out how to pass the managedObjectContext from the App Delegate (where it is created) all the way through to eac...

Import data from Excel File to Core Data

hi, I have thousands of students records in Excel sheet. Now i will import that all data into Coradata [from Excel sheet to Coredata] and i will create my IPhone application using that coredata. I dont have any idea, how to import excel file data into coredata. If anybody knows the steps, please help me. Thanks. ...

How do I change an NSManagedObject's type?

Let's say I have an inheritance hierarchy as follows: Device <- EthernetDevice <- WirelessDevice So a Wireless device is a subclass of EthernetDevice, which is a subclass of Device. Ok, so if a user creates a Device object and the user later decides that it's actually a Wireless device, how do I change the object's type? At the moment...

What is the most efficient way to update the value of all or some managed objects in Core Data in Objective-C

I've googled and researched but am not able to find the best way to iterate through all or some managed objects in my Data Model and update an attribute value in each of them, in my situation, update to the current date. The managed object context and persistent store delegate methods are all in my Application Delegate. I could add som...

Can a managed object with unmanaged properties fault?

The Core Data documentation says that objects may fault to save memory if needed. What happens if you have an object that has a property that is not a managed property? For example, say you have a Department class, that is a subclass of NSManagedObject. It has a location iVar + accessors. The location property is not an attribute of Dep...

Entities missing from Core Data sets when using pre-populated data files?

Hi all, My application has two parts; a data importer part that takes a text file and creates Core Data objects from the data and then "saves" the data file (in this case, nutritional information for different foods). The data file is then used by the app. The issue I'm running into is when I go to list the contents of a relationship,...