core-data

Core Data / NSArray Causing Leaks?

I am having a specific leak that I can't seem to dig to the bottom of, cause my search always ends up in some Apple libraries. Any help from some veterans at dealing with this would be appreciated. Here is the relevant source code: (leak indicated with a comment) - (void)viewDidLoad { //[super viewDidLoad]; NSManagedObjectContext *con...

Core Data Fetched Results Controller and Custom Section Header

I am familiar with the common and basic use of a NSFetchedResultsController managing the rows of a table, but I have an interesting problem. My data is organized as such: Schedule <--->> Day <--->> Route. I currently have a table view that has Schedules with a fetch controller managing the creation and deletion of Schedules. I now wan...

Using GameKit to transfer CoreData data between iPhones.

I have an application where I would like to exchange information, managed via Core Data, between two iPhones. Has anyone attempted this and if so what is deemed to be the best approach to doing so (i.e. are people using some intermediate format such as XML or JSON in a file or can the objects be transfered directly). My apologies if t...

How to force coredata to rebuild sqlite database model?

Hello, In my app I sometimes need to rebuild and repopulate database file. SQLite databse is created and managed by CoreData stack. What I'm trying to do is drop the file and then simply recreate persistentStoreCoordinator object. It works under simulator but not on device, where I'm getting such an error: NSFilePath = "/var/mobile/A...

UITableView Core Data reordering

I know this question has been asked before, and I took a look at the answer to this question. However, I'm still confused as to how to implement reordering with a UITableView in a Core Data project. What I know is that I need to have a "displayOrder" attribute in my Entity to track the order of items, and I need to enumerate through all ...

CoreData updated sqlite database

Hey there, I'm working on my first application using coredata. Everything works perfectly. When I debug the app on my device (without it already being installed on the device), then quit the app, manually modify the sqlite dbase then debug the app again, it appears to be using the old version of the database. If the two sqlite files h...

JSON and Core Data on the iPhone

I have a core data object graph (consisting of two entities linked by a to-many relationship). I was curious, as a relatively inexperienced iPhone developer, whether anyone could recommend an approach, and a suitable JSON implementation for the iPhone, which would allow me to: 1) convert the core data records into a JSON string (whils...

Move object from one Core Data UITableView to another?

I'm trying to move an object from a fetchedresultscontroller to another. The code looks like this: UISegmentedControl *segmentedControl = self.navigationItem.titleView; NSManagedObject *managedObject = [fetchedResultsController objectAtIndexPath:indexPath]; NSDate *timeValue = [[managedObject valueForKey:@"timeStamp"] copy]; NSManagedO...

Binding selection across multiple view controllers in a single window interface

I am having an issue wrapping my head around how to hook up a few NSArrayControllers across two view controllers. I want to sync the selection in the source list table view to update the values in the second detail view controller. I'm using the Cocoa Dev Central Build A Core Data Tutorial as the starting point, but have broke down ...

Bulding a new "Core Data" AtomicStore, the missing pieces

I am in the process to implement an AtomicStore subclass to save data in a MySQL DB. The system already works pretty well besides the implementation of fetch-requests. The fetches should include the cached nodes but also fire a "select" on the underlaying SQL db. I have currently only worked on SubClasses for NSAtomicStore and NSAtomicS...

Decimal amount from UITextField to Core Data integer field

Hi all, I have a UITextField in my app that accepts decimal amounts for prices (i.e., 123.45). This field is stored in Core Data as an integer. The code I have that doesn't work is: [self.managedObject setValue:[textField floatValue]*100 forKey:@"price"] And I can't quite figure out how to make this work. Any ideas? Thanks! ...

How do I delete all objects from my persistent store in Core Data?

Hi all, I have Core Data working in my app. So, I fetch an XML file, parse the data into model objects and insert them into core data. They are saved in the persistent store and I can access them when I relaunch the app. However, I want to be able to refresh the data in the persistent store at will, so I need to first remove existing ...

iPhone core data problem : referenceData64 only defined for abstract class

I have an application that downloads/parses a big XML file and store the information using core data (approx. 4000 objects (entities)). The XML is loaded/parsed in a different thread, which has its own NSManagedObjectContext. When trying to save the entities to the persistent store, I sometimes get the following error (about 20%) 2010...

Core Data - Decimal Type for Currency

Hi all, I read in a recent post that the Decimal data type is the best to use in Core Data to model currency since it doesn't have floating point issues. I've searched the apple docs and google and can't seem to find any documentation on using the Decimal type. Does anyone have a link to documentation on it? Thanks! ...

Download, save, and play mp3 on an iPhone

Hi, I would like to download an mp3 file from some site, save it to my CoreData model, AudioMp3, and play it. The function below sort of works, but firstly, is inefficient in that it has to save the mp3 to file first, and secondly it plays a repeat of the same mp3 the following times it is called. I don't think my save to database is r...

Unable to save correct Date using CoreData

I created a CoreData application using the Cocoa Touch Template. I modified the included .xcdatamodel file to have an attribute called 'Date' with datatype of 'Date' and other string attributes. I use following codes to save data for the 'Date' field: NSDateFormatter *dateFormatter=[[[NSDateFormatter alloc] init] autorelease] ; [dateFo...

Getting Core Data Entity from a Parent Entity

I'm trying to retrieve data from an Entity in Core Data where I know the value of a related Entity. IE: Entity1 -attrib1.1 -attrib1.2 -relationship1 Entity2 -attrib2.1 -relationship1 Entity1 has a to-many relationship to Entity2 on relationship1. I'm trying to get the value of Entity2 where Entity1.attrib1.1 = XXX. I tried using NSP...

SearchDisplayController & Coredata Search locks the application while loading, what can i do?

Hello friends. I am building an application with coredata. Its nearly finished but i have a problem. I want to put a search section on my application. I did it now and it is working, but there is something weird and i could not solve. When clicked on the search button, i am preparing my Predicates and search my database, and show the ...

Core Data best practices question for Navigation iPhone App

Using Apple's Mail application as an example; pretend it uses Core Data. When you touch an email account, it shows you all the messages in that account. So the controller did a fetch request for all the messages in that account. Then you touch a message and drill one level deeper, now you are viewing a single message. This single messag...

iPhone SDK Core Data or a 2D Array

I have a data set that is around 700 rows with eight columns of string data. Is it worth setting up core data? Will I see a huge performance difference if between Core Data and an array? The app is a simple UITableView and and a couple of drill down style detail views. I will be searching the data set on one of detail views. ...