core-data

iPhone - Store float in SQLite thru CoreData

Hi everyone, I store a float number in my SQLite (through core data) like this: unit.conversion = [NSNumber numberWithFloat:0.001]; When I look at the SQLite database the value is 0.0010000000474974513 unit.conversion is an optional float in my datamodel... What's wrong with that? Thanks ...

iPhone Core data drilldown with multiple tables

I have an app I am working on that has 2 entities linked by a relationship (many to many). I currently have the app set up so that the rootviewcontroller controls the NSManagedObject (getting, setting, deleting of the data) in the first entity. When I drill down into on of the first entities it goes to a secondview (secondviewcontroller...

Iphone Core Data: Date Default Value as Current date

Hi, Im using Core data. I have an entity with an attribute of type Date. Is there a way I can set Default Values as Current Date? (Like entering 'CURRENTDATE' or something in default value of the attribute?) Thanks ...

Core Data migration "can't merge models with two different entities named 'foo'"

I know this is a frequently asked question, however none of the solutions that I have found seem to work for me. This is my situation: I have one data model for my application, and I wanted to add versioning to it. So in XCode, I did Design -> Data Model -> Add Model Version. I also updated my delegate's persistentStoreCoordinator metho...

Starting out with Core Data and relationships.

What I'm trying to build is an application that allows users to add a category to the first entity (CategoryItem) and then add feeds to that via a second entity (FeedItem). So far, the CategoryItem entity has *action attribute which is used as the naming of the category (String). The FeedItem entity has two attributes, *feedName and *f...

Reload CoreData DB

Hello, In some part of my app I replace the db.sqlite file used by CoreData to store all my app data but the loaded data doesn't change. I noticed that the new data is only shown when I restart the app. Maybe someone can explain-me why this happens and how to solve it. Thank you very much, ...

Core Data - Saving Relationships

Hi. If a Core Data relationship has an inverse relationship do you only need to set one of the relationships objects then the corresponding relationship is setup? In the past I have set both relationships but when looking at iPhone Core Data Recipes it seems they only set 1 of the relationships? Thanks James ...

How do ensure that a Core Data Fetched Property is fetched from the context rather than the cache?

I have a managed Object Model that contains 2 Entities. One of the entities (Lets Call it EA) calculates it's properties by referencing some properties in a sub-set of the second entity (Call it EB). Within EA I have set up a "Fetched Property" with a predicate that returns the subset of EB objects that I need. When I Delete, Insert a...

Core Data Compound Predicate Performance Issues

I'm having a strange performance issue with core data and compound predicates. I have no problem doing very basic predicates or relatively complex ones, but if I try to create one that is 'somewhere in the middle' (a basic numeric match and an 'or' of a to-many relationship; see the 3rd example below), the app becomes un-responsive and h...

Insert tablecell when CoreData object has been added

Does anyone have some tips as to how to insert tablecells when CoreData objects have been added? What possibilities does coredata have to notify the tableView? Or should the tableView monitor CoreData? Will I get into trouble when doing a reloadData? I am looking for a/the way to do this. I can probably figure the code out from there. ...

Should I use a background thread for my UI actions?

Background I've got an NSOutlineView that shows TrainingGroup entities. Each TrainingGroup represents a folder on the local machine. The NSOutlineView is bound to an NSTreeController with a fetch predicate of IsTrained == 0 Each TrainingGroup can be assigned to a project. Each TrainingGroup has many TrainingEntries that show a time wor...

How To Use the CHCSVParser class

Hello all (but mostly Dave), I am playing around with Dave DeLong's excellent CHCSVParser for Objective-C with an extremely long .CSV file and am running into some trouble using it. I would use the arrayWithContentsOfCSVFile method, but I'm running the code on an iPhone and parsing the whole file into memory would take more memory than...

Splitview with core data not calling DetailRootController

I'm running a splitview core data template setup for an iPad app. When a row was selected on the left tableview it would case the selected object of the row to be assigned to the right side view(DetailViewController) and update the view with the proper data. Below is the code that does the assigning in the left side controller(RootViewCo...

How can I get my table view to redisplay data when objects are deleted?

I have table view which is in a view controller that inherits from UITableViewController. I use a NSFetchedResultsController that I use to fetch the table data from my core data store. I've tried it with both caching on and off. I set the delegate of the NSFetchedResultsController to be self and I've implemented controllerDidChangeCont...

iPhone CoreData migration fails with "Can't find model for source store"

I have an iPhone app that is using CoreData. I recently made some minor changes to the data model and now every time the app is opened I get an error "Can't find model for source store". I have 2 version of the data model and the only changes I've made were some additions of some fields. I was following the guide here which worked initi...

CoreData/SQLite fastest way to determine if a field doesn't end with a particular string

I'm using CoreData backed by SQLite and I'm trying to find the fastest way to exclude rows where the field AirDate ends with -00-00 I've noticed that [NSPredicate predicateWithFormat:@"NOT AirDate CONTAINS %@", @"-00-00"] is much faster than [NSPredicate predicateWithFormat:@"NOT AirDate LIKE %@", @"*-00-00"] Are there any other o...

Where store fetch array data?

I try [eventArray value] but nothing - i get like that 78999 3451237 3451237 But must be 90 NSEntityDescription *entity = [NSEntityDescription entityForName:@"Event" inManagedObjectContext:app.managedObjectContext]; NSFetchRequest *request = [[NSFetchRequest alloc] init]; [request setEntity:entity]; NSSortDescriptor *sortD...

iOS CoreData: NSFetchedResultsController performances

Hi! In the model, I have two entities: Record and Category. Category is one-to-many with Record through inverse relationship. The persistent store is of SQLITE type and the db is not so small, about 23MB (17k records). I use a list-detail design to show the records table and the detailed record view.The list viewController uses NSFetch...

Core Data Migration loses NSNumber value

After migration, one of my numerical values that should be non-zero now appears as zero. If I don't migrate, the value retains its non-zero value. I first tried to set a number value in a managed object like this: [temp setNumUses:temp.numUses+1]; ... but that caused an'EXC_BAD_ACCESS' so I changed it to: int hold = ((int)[[temp val...

How to store CLLocation using Core Data (iPhone)?

Hi, I'm trying to save a location and retrieve the location on a map afterward using Core Location, MapKit and Core Data frameworks. What I've done is I just made entity named POI and added properties such as latitude (double type), longitude (double type) with few others. Simply put, my app saves POI with two NSNumbers. (lat and l...