core-data

iPhone Core Data objects added to NSMutableArray

I am trying to have a bunch of Core Data objects (NSStrings) be added to an NSMutableArray so that I pickerView can use the strings as its data values. Currently I am able to save strings from a textField one at a time into the sqlite file, in Core Data. I am having trouble pulling those Objects back out of the Core Data sqlite file an...

Adding a relationship with a button

I'm building a Core Data application, and I want a button to add the selected object (Player) to a relationship (Team) corresponding with that button. Add, fetch, insert? Is this a bindings issue, with Argument and Target? Thanks a ton in advance for your help, -Dan ...

Copying whole object graph - copy a relation

I have a model with 2 entities: RealEstate and Container Containers object are already saved onto the persistent store with the following hierarchy: Container 1 Container 2 Container 3 Container 4 Container 5 Container 6 Each container has a RealEstate owner (in a given hierarchy the realEstate is always the same)...

Store static Content on iPhone?

Hi there, I was wondering what is the best way to store static content for my app. E.g. a list of products (name, photos, price, url). Maybe s.o. can direct to a good tutorial? thanks. ...

Are predicate templates the same thing like prepared statements?

For example if I had this predicate format string, would that have the same security benefits like prepared statements in SQL offer? @"name == $LAST_NAME" I am not sure if this is a plain stupid substitution which still allows bad "SQL" injection to core data, or if this is just as good as prepared statements known from modern db tech...

Deleting Core Data object before popping a view from the UINavigationController

The following code deletes a core data object if the user did not end up modifying the new entry (this happens on an insert operation). The root view controller created the entity and passed a reference to my view. It works fine if the user hits a "done" button on my view, but if instead they navigate backwards using the "back" button on...

Copy local SQLite Database to iPhone?

Hi there, i am doing some experiments with coredata and objective-c. My application works fine in the simulator. It also works on my iPodTouch. But how to i copy my local database to my device? thanks, ...

A strange iPhone CORE DATA error behavior

Hi there, I have a really strange behavior in a Core Data app. This is the code: unaReg.valore = [NSNumber numberWithInt:val]; NSError *error; if (![managedObjectContext save:&error]) { [myUtil manageError:[error localizedDescription]]; } unaReg is a Core Data Entity and I want to update its...

How to remove an unsaved object from a managedObjectContext

Hi all, I'm having a problem with a Core Data project on the iPhone. The scenario occurs when a user starts to add an object, then cancels during the process. If the user hits cancel and returns to the list of objects, a dummy object is listed there, representing the one they were in the middle of creating. This is never saved to the ...

iPhone Core Data "Production" Error Handling

Hi there, I've seen in the example code supplied by Apple references to how you should handle Core Data errors. I.e: NSError *error = nil; if (![context save:&error]) { /* Replace this implementation with code to handle the error appropriately. abort() causes the application to generate a crash log and terminate. You should not use ...

How do I reference the managedObjectContext in my App Delegate from my View Controller?

Hi, I know there are other questions covering this topic, but none seem to fit exactly what I'm experiencing, hence the new question. I have an app which is a UITabBarController, I have defined two subviews Both tabs have their Class attribute in the Identity Inspector set to UINavigationController. Both subviews are Class UIViewContr...

Is there anyway to populate a UITableView with an array but persist checkmarks?

Hello all, I have an app that has a tab bar, each tab contains a separate table. The first table uses core data to persist its entries and checkmarks. The second table on the second tab uses an NSMutableArray to populate it (I would use core data but I would have to pre populate it and this table does not allow that) I would like to per...

Testing controller method with OCMock and Core Data

I am just grasping the concepts of TDD and mocking, and am running into an issue in terms of how to properly. I have a sheet that drops down and lets a user create a new core data object and save it to the data store. I am not sure if I am taking the best approach to testing it. - (IBAction)add:(id)sender { NSString *itemName = [...

How view data stored in Core Data?

I'm creating a Core Data model for my application. I would like to be able to look inside it to see what I have stored in there. Is there an easier way than searching for the backing store (mine should be SQLite) and reading it from there? Doesn't seem very Apple-esque. ...

Core Data persistent object located on Amazon S3?

I am curious if my persistent object of Core Data can be stored and retrieved using Amazon S3. I think it is a perfect combination to put your application on the cloud. Or Amazon has other services? Has anyone had any success stories to share? Edited: I know that there is no direct support of Core Data for S3, but there is ASIS3Req...

Core data images from desktop to iphone

I built a simple mac data entry tool I use with an iPhone application. I've recently added thumbnail which I added via an Image Well using simple bindings. Its a transformable data type which seems to work fine. The iPhone application however won't show the images. The attribute isn't null but I can't get an image to appear. The followi...

MVC in a Cocoa document-based application

I'm going through a refactoring and reorganization of my application at the moment. I've realized that some of the separation between models and views, and their controllers has diminished and I wish to do some cleaning up. I have several key classes used in my app: NSPersistentDocument, NSWindowController, and a model class. The NSPer...

Is it bad to modify Core Data properties in validateForUpdate:?

I am using Core Data for an iPhone application. I have a property isChangedFromOriginal that defines if the data (for several fields - if one is changed it is the same as if all were changed) was changed from a preloaded standard. I am planning to create a subclass of NSManagedObject and perform the checks in ValidateForUpdate:, howe...

Cocoa data hierarchy and browser

I'm trying to implement something similar to the iTunes browser, to browser a simple database of Books. I have the following entities - Author, Genre and Book. I would like to display an author list and a genre list, which act to filter the main Book list. I have tried doing this in 2 different ways - modeled as: Author ( has many ) ...

How can I convert the date string calculated by CoreData to ISO format YYYY-MM-DD HH:MM:SS +000?

I have a string like this, 285298171.84336197376251220703 and I know it's created by CoreData and I want to find a way to convert it into ISO format, can anyone help me? Thanks in advance. Added: actually this is in an XML file which an application created. 285298171.84336197376251220703 281021264.12619298696517944336 ...