core-data

Bluetooth Transfer for Core Data Entities

How would I go about using bluetooth to transfer a core data entity with it's corresponding relationships? I have three core data entities with inverse relationships set up and it all works fine, but I need to transfer these to another iPhone based on the context that it is not in the corresponding table in the core data entity set on th...

[iPhone] Objective-C : Relationship to own class (CoreData)

Hey folks! In my project there is a managed object called "Group". This object itself can contain child group objects. How do I solve this situation in CoreData and in the FetchedResultsController? My first shot: http://i46.tinypic.com/zvonpd.png Thanks, Dan ...

Core Data NSFetchedResultsController - Total number of records returned

Hello, I'm using an NSFetchedResultsController in an iPhone app, and am wondering if there is some easy way of getting the total number of rows returned in all sections. Instead of getting the [[fetchedResultsController sections] count] and then looping through each section to get its count, can it be done in one line? Thanks! ...

[iPhone] release NSData in NSManagedObject

Hi, I use datamodel to store 2 objects : Video, Images. Video contain just string attributes and Images have 2 "Binary data" attributes. At the start the 2 binary data attributes was in the video object. But all videos are loading during initialization of UITableView. For 400 videos binary data represent 20 Mo, so imagine with 4000 vid...

Storing HTML in a Core Data app

As a follow up to this previous question, I have a Core Data-based iPhone app that gets its underlying SQLite database file pre-loaded by a small utility, written in Cocoa, which I also wrote. Basically, I'm taking data from text files and building my data off-line, so the app is as fast as possible when it runs (i.e. no data parsing on ...

Question regarding core data and the camera.

So I am working on an app that uses core data to store attributes of objects that the user can set. I have primarily been focusing on the first part, which was setting everything up on the core data side, and now I am ready to move on to the next part which deals with the camera. I want to be able to add a city, or other geographical loc...

How to properly cascade delete managed objects in Core Data?

I have a Core Data model which has three entities: A, B, and C. A has a one-to-many relationship with B, and B has a many-to-many relationship with C. The delete rule for A -> B is "Cascade", and B -> A is "No Action". The delete rule for B -> C is "No Action", and C -> B is "Deny". I am having trouble performing a delete on the A entit...

Updating NSTableView when enitiy is added to core data

I have a Cocoa App that I have manually added core data to. I setup the table in Interface Builder to list the entities from the data (with NSArrayController), and this is working just fine. The problem is when I insert a new entity (via code) the table does not update until I restart the app. What do I have to do after inserting an en...

Core Data is using a lot of memory

I have a data model which is sort of like this simplified drawing: It's a little weird, but the idea is that the app manages multiple accounts/identities a person may have into a single messaging system. Each account is associated with one user on the system, and each message could potentially be seen/sent-to multiple accounts (but th...

IPhone Core Data Persistence & Lifecycle Question

Whenever I build & run my program I notice that a new directory gets created in: /Users/Username/Library/Application Support/iPhone Simulator/User/Applications Therefore, there's no way for me to persist core data between application builds. The way I thought to get around this issue (from a testing point of view) was to just use the ip...

Why is NSFetchedResultsController not correctly loading section titles?

I am using NSFetchedResultsController along with a UITableViewController. I've created a transient field in my Core Data model to use as a label for my UITableView sections. The name of the field is "sectionIndex". In my application, a "Client" entity has many "Jobs" (1 to many) - so my query to retrieve Jobs groups them (via section) b...

Core Data: An Inverse Relationship to multiple entities?

Let's say I have 4 entities in my data model: Person, Car, Pet, and Photo. I would like a relationship from Person Car and Pet to the Photo entity, in that I'd like each of those things to contain a photo of that item. So far, no problems. Though where it gets tricky is the inverse relationship, which is where the photo entity would want...

Setting a limit to a fetched property in Core Data

Hi I have a one to many relationship between two objects, lets call them Gallery and Images. Each Image belongs to a Gallery and each Gallery has many Images. I would like to add a fetched property to my Gallery model which would return one and only one Image object. Is there a way to do this with fetched properties? ...

CoreData (for iphone) storing images

i wonder if its a wise choice to store images with core data into binary property say i have a collection of movies and i want to save the image dvd cover into a property the avg size of a cover is 20/30kb (320x480px) the reason i want to do this is for storage management, once i delete the movie i know the image is also deleted i'm j...

Fetching relations with Core Data

Hi, I have two managed objects which have a bidirectional relationship. It is a 'segmentWithDetails' which contains a 'segment' object. I use NSEntityDescription *entity = [NSEntityDescription entityForName:@"SegmentWithDetails" inManagedObjectContext:connectionDetailsService.connectionDetai...

NSArrayController creating, modifying and then selecting a new object

The main view of my NSPersistentDocument based application is a table view (bound to an NSArrayController) showing the list of records, below it there is an "add record" button. I want the button to cause the following (supposedly trivial) behavior. Create an new object Set some defaults to the new object (that are stored in the main ...

Can I create an new instance of my custom managed object class without going through NSEntityDescription?

From an Apple example, I have this: Event *event = (Event*)[NSEntityDescription insertNewObjectForEntityForName:@"Event" inManagedObjectContext:self.managedObjectContext]; Event inherits from NSManagedObject. Is there a way to avoid this weird call to NSEntityDescription and instead just alloc+init somehow directly ...

Why must I make an mutable copy of this array?

Apple provided this example: NSError *error; NSMutableArray *mutableFetchResults = [[managedObjectContext executeFetchRequest:request error:&error] mutableCopy]; if (mutableFetchResults == nil) { // Handle the error } Why are they calling mutableCopy here? Is it because they wanted to have an NSMutableArray rather than an NSArray,...

MUST I provide an NSSortDescriptor in core data when doing a fetch request?

I wonder if I could just execute a NSFetchRequest with just the Entity and nothing else. However, it seems to work with no errors, but since I've never seen anyone doing that, I wonder if there are any bad drawbacks in doing this. The documentation doesn't say if there's any default value used instead when I provide no NSSortDescriptor. ...

Core Data: communicating extra context to objects fetched with NSFetchedResultsController ?

I'm using NSFetchedResultsController pretty much out-of-box in the way that the documentation describes. Here is an excerpt of my code. NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init]; NSEntityDescription *entity = [NSEntityDescription entityForName:@"SomeEntity" inManagedObjectCont...