core-data

iPhone: Core Data save Class object

I have an entity in core data called Location. Inside this I have a few fields, such as date. But, I would also like to save a class object in it that I created called Annotation. What type of attribute would I use for this, since it is a custom class object that I created? Location (object) |__ Date |__ Annotation (MKAnnotation prot...

How does the sectioning work with NSFetchedResultsController?

When creating an NSFetchedResultsController instance, there is this sectionNameKeyPath: argument, which most peoeple seem to set to nil. Now lets say I have Employees in the table view and I want that they're sectioned by their street address streetName. Every Employee is associated with an StreetAddress Property. So I would put an @"add...

What's the point of having to provide a cacheName for NSFetchedResultsController?

NSFetchedResultsController *frc = [[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest managedObjectContext:moc sectionNameKeyPath:nil cacheName:@"Root"]; Why do we have to think about a cacheName? How important is this decision? What would happen if there are two NSFetchedResultsController instances using the exact sa...

Which kind of changes can't I do with lightweight migration in Core Data?

I recently tried a lot of different stuff with lightweight migration. These all work: 1) Rename attributes (with renaming identifier specified) 2) Add attributes 3) Add new entity + new attribute + inverse relationship to an already existing entity 4) remove existing entity + relationships to that entity = It almost looks like jus...

Isn't using lightweight migration with dozens of updates going to kill performance?

One think I notices is, that I must probably keep the whole stack of model versions intact when shipping updates. I am not sure what happens if someone has version 1.0 with populated data, and then instantly updates to version 5.0 without any of the versions inbetween. So the migration must also know what was that very first data model l...

What happens if a user jumps over 10 versions before updating, and every version had a new data model?

Example: User installs app v.1.0, adds data. Then the dev submits 10 updates in 10 weeks. After 11 weeks, the user wants v.11.0 and grabs a copy from the app store. Assuming that the app has got 11 .xcdatamodel versions inside, where ***11.xcdatamodel is the current one, what would happen now since the persistent store of the user is a...

Why doesn't the undo/redo panel appear when I start a shake gesture in iPhone Simulator?

I've created an NSUndoManager for the Managed Object Context of Core Data, like this: NSUndoManager *undoManager = [[NSUndoManager alloc] init]; [undoManager setLevelsOfUndo:10]; [managedObjectContext setUndoManager:undoManager]; [undoManager release]; In the app delegate where the didFinishLaunching method is called, I did this: app...

Why should I call -processPendingChanges when blocking things from undo-registration?

Example: [[managedObjectContext undoManager] disableUndoRegistration]; // changes which shouldn't be undo-able [managedObjectContext processPendingChanges]; [[managedObjectContext undoManager] enableUndoRegistration]; Is that really important? What's the point? ...

what is best way to store long term data in iphone Core Data or SQLLite?

Hi all, I am working on i-Phone app targeting 3.1.3 and later SDK. I want to know the best way to store user's long term data on i-phone without losing performance, consistency and security. I know, that i can use Core Data, PList and SQL-Lite for storing user specific data in custom formats.But, want to know which one is good to use w...

Must I do something special in order to have sections with an NSFetchedResultsController?

I created a fresh project with a core data template. then I added a employee entity with a firstName string attribute, and populated the persistent store with 100 employees and lots of different first names. In the RootViewController where the FRC is created, I set the sectionNameKeyPath like this: NSFetchedResultsController *frc = [[N...

iPhone CoreData: How to group fetched results by day?

Hi! I am developing an iPhone App with CoreData. One of my entities has an NSDate property named 'time'. It stores times to the minute/second. As my sections i'd like to have the date to the day. So if there are to entries '2010-06-14 8:00' and '2010-06-14 11:00', i'd like them to be grouped to '2010-06-14'. Currently I just use @"time...

Does it make sense to use a NSFetchedResultsController without an UITableViewController? How are they related?

I mean... could I also just create a plain old UIViewController and then set up a UITableView myself, plus an NSFetchedResultsController? How much do UITableViewController and NSFetchedResultsController interact with eachother? As far as I see it, UITableViewController is NOT by default already adopting the NSFetchedResultsControllerDel...

Using same name for Core Data object as a Private Framework Object

Hi all, I've got a core data-based app for iPhone and I'm getting the following warning: objc[2472]: Class Property is implemented in both /System/Library/PrivateFrameworks/Notes.framework/Notes and /var/mobile/Applications/B69194FF-448F-48AD-A78D-DDB8935F/AmcCalc.app/AmcCalc. One of the two will be used. Which one is undefined. When...

Question regarding ideal database implementation for iPhone app

So I have a question about the ideal setup for an app I am getting ready to build. The app is basically going to be a memorization tool and I already have an sqlite database full of content that I will be using for the app. The user will navigate through the contents of the database(using the uipickerview), and select something for mem...

Should repeated use of the camera crash an app?

I have an app that builds a slideshow from user images. They can grab from their library or take a picture. I have found that repeated use of grabbing an image from the library is fine. But repeated use of taking a picture causes erratic behavior. I have been getting crashes but mostly what happens seems to be a reloading of the view ...

Getting crash after picking images from UIImagePickerController (Related to memory leak?)

I have been trying to minimize my memory footprint with UIImagePickerController, but I'm starting to think that the memory problems I am having are resulting from poor memory management, instead of a particular way to handle the UIImagePickerController object. My workflow is this: The "Edit Image" button is clicked, which presents a UIA...

Core data and special characters (UTF-8)

I have an iPhone application using Core Data with an SQLite database in the bottom. I'm writing some text content from the database to a file, but special characters such as Å, Ä and Ö are corrupted in the file (they show up just fine in the application). When creating and inserting data, I am not using any special encoding. I'm just ta...

iPhone Core Data-driven Search: How To, Resources?

I have a very simple Core Data app which pretty much contains strings of text. I would like to make this text searchable, and can see a "Search Bar and Search Display Controller" object in Interface Builder. Firstly, would using this Search Bar and Search Display Controller be the best approach for a simple Core Data-driven text search?...

Core Data Relationship problem

I have a very simple model with two objects: Name and Category. One Name can be in many Categories (it's one way relationship). I'm trying to create 8 Categories every with 8 Names. Example code: NSMutableArray *localArray = [NSMutableArray arrayWithObjects: [NSMutableDictionary dictionaryWithOb...

Core Data, managed object context, NSArrayController.. straighten me out a bit

So I've got an .xcdatamodel with about a dozen Entities defined and related to each other, with attributes and so on. So far I've been trying this in to a GUI using NSTableViews to display/enter data, and NSArrayControllers that I instantiate for each entity. This is all working great. They all tie in to the App Delegate's Managed Ob...