core-data

Creating a list of entity parents using a core data fetch request/predicate.

I have a core data model, using the database store, that contains entities with classic parent/child relationships. Each parent has a number of children, each child a single parent, creating a multi-level hierarchy. What I would like to do is use a predicate in a fetch request to return a list of all the entities between a given entity...

Iphone: Error while Inserting Objects in Core Data

I have a Uitableview that loads data from a parsed xml feed. when the feed is first parsed all the text data is stored in an entity NewsItems in core data. after the table is loaded the images asociated with each object are fetched asynchronously and stored in a separate entity NewsImages, after the feeds/images are stored locally all da...

[NSConcreteData scale]: unrecognized selector sent to instance when accessing an image property

Hi, I've a problem when I try to access the image property of one Core Data Model: #import <CoreData/CoreData.h> @class IngredientWithQuantity; @interface Cocktail : NSManagedObject { } @property (nonatomic, retain) UIImage *image; @property (nonatomic, retain) NSString * name; @property (nonatomic, retain) NSString * desc; @prope...

Error while fetch in core data

I get an error with setPropertyToFetch. Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSCFArray initWithObjects:count:]: attempt to insert nil object at objects[0]' code: NSString *str; str = [NSString stringWithFormat:@"Event%d", variable]; NSString *value = [NSString stringWithFormat:@"val...

NSAttributedString as a Transformable Attribute in Core Data Entity

In the Core Data Programming Guide under "Transformable Attributes" here: http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/CoreData/Articles/cdNSAttributes.html It is stated "You can now use the attribute as you would any other standard attribute, as illustrated in the following code fragment:" The follow line of ...

tool to retrieve data from .sqllite local db

is any tool is there to retrieve/view datas from .sqllite iphone local database and is there any way to view data without fetching and storing it to tableview. ...

NSFetchedResultsController with predicate ignores changes merged from different NSManagedObjectContext

I am presenting table view contents using NSFetchedResultsController which has a predicate: [NSPredicate predicateWithFormat:@"visible == %@", [NSNumber numberWithBool:YES]] On background thread using separate NSManagedObjectContext I update few of the entities and change theirs visible value from NO to YES. Save, merge changes in mai...

"Delivering Notifications To Particular Threads" - Exception when run on iPhone hardware

I have implemented thread-targeted notifications as per the Apple document "Delivering Notifications To Particular Threads" (http://developer.apple.com/library/ios/#documentation/Cocoa/Conceptual/Notifications/Articles/Threading.html#//apple_ref/doc/uid/20001289-CEGJFDFG) in my app, and it works great when run in the Simulator (iPhone 4 ...

NSSortDescriptor is not working while fetching records from Core Data.

I am trying to use NSSortDescriptor in Core Data to fetch my records. Array of modal-objects doesn't get affected by sort descriptor. It gives records in same order.Here is my code: NSManagedObjectContext *moc=[self managedObjectContext]; NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init]; NSEntityDescription *entity = [NSEnti...

Importing a MySQL schema to Xcode as a CoreData Data Model

I have an existing MySQL database, I would like to import the schema into Xcode and create a Core Data data model. Is there a way (tool, process) to import the CREATE statements so I don't have to build the models "by hand"? As an intermediary step I could convert to SQLite, I'm not worried about the relationships, foreign keys etc jus...

Changing Core Data Items crashes App

Hey Guys, I am running into another problem with my Iphone App which I just can't solve myself. I implemented a kind of organizer functionality in my latest app. There one can create appointments which are displayed in a tableview and persisted in a CoreDataStore. I use 4 classes: an overview where appointments are displayed a view ...

Parent Entity and Relationship in Core Data.

Hello all, I am learning Core Data so I was confused about the following. I need to know how the relationships worked in the inherited scenario. I have a data model with Entities Zoo, Animal , Dog, Lion. Dog and Lion have Animal as the parent Entity. Now Zoo has one to many relationship to animal. I want to know if Zoo will need to...

Core Data Saving to Database not Working

Hi, I'm a first time Core Data user/learner for iPhone, I thought that [managedObjectContext save:$error] was used to save changes to the Persistant Store. But when I reload and call NSFetch, the objects are still there. Any ideas why? for (int i ; i < [mutableFetchResults count];i++) { NSManagedObject *toDelete = [mutableFetchResu...

Overpersistent files on the iPad

I copy some text files from a server to the NSDocumentDirectory on the iPad. One of the files has a .sql extension. They all store correctly and everything works OK, except there's one puzzling thing: When I delete the application from the iPad (make it wiggle and hit the X), all the existing files get deleted (as I'd expect) except fo...

insertNewObjectForEntityForName returns wrong type

Hello everyone, I've been pulling my hair for the last few hours trying to figure out why insertNewObjectForEntityForName is returning NSManagedObject even though I'm trying to insert an entity of my own type. Things I have checked a thousand times: Class name is set to the correct value in the diagram designer Entity has many-to-man...

Core Data NSFetchedResultsController Performance Advantages Over NSArray?

Does using an NSFetchedResultsController provide any performance advantages on the iPhone over an NSArray? I have between 4,000 and 8,000 records stored in core data and wanted to know if I should select one over the other. Is the NSFetchedResultsController just used to make code 'prettier'? My concern is searching, and lag on keyboa...

Is it possible to sort by subclasses in an `NSFetchRequest` without adding additional attributes?

I want to group the results of a NSFetchRequest by entity. The entities all share the same abstract parent. For example: animal | |-cat | |-dog The NSFetchRequest has includesSubentities set TRUE and entity set to animal. It is possible to set sectionNameKeyPath of NSFetchedResultsController to entity.name but it is not possible to do...

NSPredicate in NSFetchedResultsController acting strange

NSPredicate *predicate = [NSPredicate predicateWithFormat:@"List.name == 'kristof\\'s list'"]; Works as expected. However I want do something like this: NSString *listName = [[[detailItem valueForKey:@"name"] description] stringByReplacingOccurrencesOfString:@"'" withString:@"\\'"]; NSPredicate *predicate = [NSPredicate predicate...

NSFetchedResultsController with NSURLConnection

I have a User class and want to display many users' thumbnails w/ their name overlayed & a green dot overlayed if they're online, etc. in a grid-like tableView (like Grindr, similar to iPhone's Camera Roll). First, I fetch a JSON array of user data for the nearest (geographically) 20 users from the server. Then, I parse the JSON and ins...

Serious Application Error in Core Data with fetchedResultsContainer

Hi there, I get the following error when trying to add a record: Serious application error. Exception was caught during Core Data change processing. This is usually a bug within an observer of NSManagedObjectContextObjectsDidChangeNotification. The index 0 is invalid with userInfo (null) And that's it. I put breakpoi...