core-data

Generated Custom Managed Object Class does not build

I have built an data model in Xcode and I have generated a custom managed object class from one of the entities in the model. I am not sure why but I don't think the custom class is building properly. For example if I just type some random stuff in the middle of a class declaration like: @class MyOtherClass; @interface MyClass : NSM...

NSFetchedResultsController and BAD_ACCESS

Hi all, I have a UITableViewController that is fed by a NSFetchedResultsController. Everything worked fine, until I added if (self.fetchedResultsController != nil) { return self.fetchedResultsController; } to the beginning of my -(NSFetchedResultsController *)fetchedResultsController { method. The error I get is: Prog...

iPhone app crashing on [self.tableView endUpdates]

My table view shows a list of users. I'm having issues refreshing my table view after adding a user. I've tried different combinations of code and events and now the app is crashing on the endUpdates call. The app is modeled after the recipe app, so a user clicks the add button, and then a modal window appears asking for the users nam...

iPhone CoreData properties: changes to managedObjects are too slow

Hi, I have a CoreData model in my iPhone app, which is linked to a SQL Database with more than 50k records. When I generate the records classes, Xcode uses the @dynamic directive for properties. I have a property named "ISFAV", NSNumber type (CoreData does not use BOOL or Integer, it uses object types). Being short, I change the ISFAV pr...

Core Data not returning NSMutableArray property

Dear all I'm starting to feel rather stupid - I've browsed the site and found a few things that come close to my problem but just can't figure it out (help M. Zarra, after reading your book I felt pretty good about Core Data but now I'm at my wits' end!). Despite the expert's advice I've chosen to store an NSMutableArray as a transforma...

Can't import PyObjC CoreData module when using mod_wsgi with Apache

Just ported a webapp from TurboGears to Django and going through the process of getting a proper server running (i.e. not runserver). Tried going the recommended Apache + mod_wsgi route that the Django docs talk about, but for some reason the thread stalls out with no error message or anything as soon as you try to import CoreData anywh...

NSFetchedResultsController and NSManagedObjectIDResultType crashes

I´m currently working on an ipad app in which I fetch a lot of data with core data. To keep memory profile low I´m setting the requests resultType to NSManagedObjectIDResultType and grabbing objects with the -objectWithID: Method whenever I need real data. Everything works as expected. The problem is when it comes to adding/removing Ob...

Adding a relationship in my data model causes NSFetchRequest to return zero items

I have a simple entity called "Store" built in Xcode's data modeler for use in an iPhone application. I also have a class (Store) associated with it and I've been able to store and retrieve data using CoreData without any problems. Now I realized that I want to have a relationship to another entity (Aisle). There is already a one-to-o...

Coredata relationship tutorial? Adding/finding objects that belong to something?

Anyone have a link to a coredata relationship tutorial for basic create,retrieve,update,delete type operations? I have two entities set up, entity A and entity B. I have the relationships and inverse relationships set up between A and B. A can have many B. B can have only one A. Basically the tasks I need to do: 1) When adding B to ...

how do you create a NSManagedObjectContext

In core data for the iPhone, I was getting all sorts of errors trying to save data to a NSManagedObjectContext. I believe that my issues were all to do with me using a `NSManagedObjectContext' that was being used in multiple threads. So I wanted to create a new NSManagedObjectContext and try that, but I cannot find the example code to ...

How do I add an NSManagedObject to Core Data and specify it's "parent" object? (iPhone)

Okay, here's the situation. I have two NSManagedObjects called 'Store' and 'Aisle'. There is a one-to-many relationship from Store to Aisle and a one-to-one relationship from Aisle to Store. I have existing stores added in Core Data that I can access just fine. My problem is that I cannot figure out how to add an Aisle object to an e...

Core data Doubts?

Can I get results using all type of queries through features of Core data? (like Primary key, forieghn key,alter,update )? or FMDB is better than using Coredata for running all type of SQL queries? Core data will be useful in all situations? ...

NSFetchedResultsController ~ cache causing issues?

Ok here goes my setup: Object Model: * Category object is at the root * Product is linked to a Category (many-to-1) * ShoppingItem is linked to a Product (many-to-1) Application setup: My application has a TabBarController at the root and a tableviewcontroller at the root of each of the tabs. The first tableviewcontroller shows ...

Train Timetable Lookup - SQLite too slow, CoreData instead?

EDIT: I found the problem, which was totally unrelated to the below. It was due to me doing a bitwise comparison that I failed to mention below - I thought it wasn't relevant - I removed this (and found an alternative solution) and my query now executes in < 1 second on device. I'm currently working on my first iPhone application which ...

Core Data search optimization

I can't seem to find any discussion about this, but I have this question after I watched session 137 of WWDC about core data optimization. So, Melissa Turner advise to use <= and < instead of BEGINSWITH, but how do I do that with predicate substitution variables or formatted predicate? Let's use this example: @"franc" <= searchName AN...

NSUndoManager stops undoing in certain conditions

Im trying to implement an undo manager in my app using Core Data. Instead of making my own UndoManager im using the default undo manager in my ManagedObjectContext. Because of that i am not registering any actions manually, neither am i beginning or ending any undo groups. Undo works fine for most conditions however at certain conditions...

How do I get Core Data to use my own NSManagedObjectID URI scheme?

I am writing an app that connects to a database to fetch data. Since the fetching is expensive and the data is generally unchanging, I'm using CoreData to cache the results so that I can do fast, local queries. From the database, for each type, there is a string property that is guaranteed to be unique. In fact, there is a URI scheme fo...

CoreData how to detect new version of an app so I can update the model?

I have a very simple model that is created when the app is launched for the very first time and populated with the contents of a plist. I will need to re-create the model again when an update to the app is downloaded and launched. I know that you can version coredata models but I don't foresee the model itself is going to change. I will ...

Why do I get: Illegal attempt to establish a relationship ... between objects in different contexts

I only have one managed object context. I have modified the managed object store though. There are certain fields that I would like to add to every managed object. It would take far too much time to add them all one by one to every object in my system, so I decided to add them programmatically to the managed object model. In the appli...

How do I reload a NSFetchedResultsController?

I have an app that preloads a months worth of data and it gets released a day at a time. NSDate *now = [NSDate date]; // Create predicate NSPredicate *predicate = [NSPredicate predicateWithFormat:@"(location.name == %@) AND (date < %@)",longLocation,now]; Everything worked great before multi-tasking, but now that it no ...