core-data

The correct NSPredicate format for one-to-many relationship in Core Data

Hello, I have a managed object model A and B with one-to-many relationship. For this particular task, I want to retrieve all A objects which has a relation to B with a property matches to "string". I had tried @"ALL bObjects.bProperty MATCHES 'string'", and it caused an objc_exception_throw in: [NSSQLGenerator generateSQLStatementFor...

Why am I getting this error, when it cannot be true?

This is the error I get in the Xcode Debugger. But look here: How is this possible and how do i fix it? EDIT: ...

How do I tell a (managed) object to notify its KVOs that one of its properties needs to be recached?

When we have an object who has a property that's generated based on other properties, usually we implement the +keyPathsForValuesAffecting{PropertyName} class method. What I'm trying to do is basically the same thing for a property on my NSManagedObject, but traversing a relationship. My model is simple; I have two Entities, App and Ve...

Is there a reason not to use the same attribute names in Core Data entities?

I have a data model with several entities and some of those entities share attributes that naturally have the same name. Is there any reason to add detail to those names to help distinguish them or will I only ever use them in their fully qualified formats? For example, if my model had library, librarian, book, borrower and author entit...

Storing optional NSNumber in Core Data

In my core data model, I have an entity with an optional NSNumber attribute. How do I test to see if the value in that attribute is valid or not? When I test for nil... doesn't work. [self numberAttribute] == nil // always returns NO When I test for a zero value int, that doesn't work. [[self numberAttribute] intValue] == 0 /...

Data server to iPhone and back

Web services -> core data -> controller -> view and then reverse... Sound right? Or is there a better way, one that avoids the complexity of SOAP? Additionally can core Data recognize XML coming from SOAP? Thanks // :) ...

Adding core data to my iPhone app

Hello I have been here before, asking for a mapping library that could store objects in a database. Some one told me about the Core Data Framework. I have read a bit about it and I kindda understand it. I have created some "test Core data projects", where I have worked with simple problems and models ala Person and Group. But now I wan...

What are atomic store types?

Hi, I've read the Core Data references on Apple's site. But I wonder, what they mean with atomic store types? They write something of "they have to be read and written in their entirety". Could somebody clarify this, please? ...

CoreData Memory management Problem

I'm using Coredata and have a Data Model with the following toMany relationships: Rooms.isUsedBy -> Class many classes use a Room Class.hasStudents -> Students many Students are in a Class Given the Room I want to get all of the students that use the room. Here is the simplified code: -(void) studentsinRoom:(Room*)aRoom { ...

Core data: I want the pk in my fetched objects

I want to have the pk in my fetched objects, so i can use the unique pk number for a unique image filename. But i can't make it work, i just need a unique filename for my images. Does somebody has a solution for this? When i NSLog object ID i get this: NSManagedObjectID *ID = [someThing objectID]; NSLog(@"ID: %@",ID); Output: ID: 0x1...

How expensive is it to perform fetch request in Core Data?

How expensive is it to call executeFetchRequest on the managedObjectContext? Does it depend on the data set size? Is this something that can be done often or should be avoided as much as possible? ...

How to fetch only the first record in Core Data?

I am using Core Data and I only want to fetch the first record in my dataset, is it possible? ...

Updating CoreData xcdatamodel file but doesn't change its schema

I made some changes to CoreData's data model without changing the schema. I merely set the indexing on certain attributes. Do I need to do anything in order for the database to pick up the new changes? What else does the xcmodeldata file do behind the scene aside from letting us model the data model? ...

What's the best way to keep count of the data set size information in Core Data?

Right now whenever I need to access my data set size (and it can be quite frequently), I perform a countForFetchRequest on the managedObjectContext. Is this a bad thing to do? Should I manage the count locally instead? The reason I went this route is to ensure I am getting 100% correct answer. With Core Data being accessed from more th...

CoreData error while saving: "binding not implemented for this SQLType 7

Hi, i am new to Core Data and my model is to complex to describe it here, sorry. My App fetch many small amounts of data from the web and store it to the core data entities. The saving is fine sometimes, but sometimes there is an NSInternalInconsistencyException with this description binding not implemented for this SQLType 7 T...

Most elegant way to sync managed objects with controls on iPhone?

I'm trying to port an iPhone application from using SQLite to Core Data. Is there a way to sync managed objects directly with the controls that manipulate their values, without having a controller in the middle? Note: I CAN do it the hard way -- it's what I'm doing now; I'm looking for the elegant, easy, fast way. I'm paging through t...

How to access fetched property in Objective-C 2.0 using Core data.

I'm new to IPhone development and I'm currently trying my hand at Core Data. I have a couple entities that I've defined in my model. In one entity I have a fetched property. When I generate the Objective-C source files from my model, my entity that I defined with the fetched property does not have a property defined for the fetched prope...

Performing lookup on multiple entities using NSPredicate

Hi, I've run into a problem when I've been porting my code over from a SQLite database to Core Data. The data that I'm using comes from a existing database and as such has all the relationships defined using the ID of each of the tables (or entities now that I'm using Core Data). My problem is that I want to query against a single tabl...

Multiple views and source list in a Core Data app

I'm working on my first major Cocoa app for an undergraduate research project. The application is document-based and uses Core Data. One of the entities is an abstract entity, Page. Page is parent of several types of pages: ie PageWithHeaderAndFooter, PageWithTwoColumns, BasicPage etc. Page has attributes, such as title and author, that...

Fetched Properties, cross store relationships

Hi folks, I've got a store that is synchronized externally and a store that is unique to the application instance, so in order to cleanly differentiate the two I want to have some join entities between them and then resolve through to the entities between using Fetched Properties, as "discussed" in the Core Data Programming Guide: deve...