core-data

Using NSSegmentedControl with CoreData

I have a Core Data app that works to add or remove one of a Client's many Appointments with buttons bound in IB to my appointments ArrayController. The appointments content is derived from whichever Client is selected in a feed list. I wish to use a SegmentedControl, and as far as I could tell, this requires I programmatically add and r...

Setting up a one to many relationship in Core Data on the iPhone.

Hello all! I am new to iPhone development trying to figure out how to setup a one to many relationship Core Data. I have two Entities setup One Leagues which has a one to many relationship to an entity Teams. So lot's of teams in a league. Think all the teams that play baseball and are in the MLB. I am pre-filling the data when the ...

How to handle web-app data sync with iPhone Fetched Results Controller

I'm in the middle of developing a companion iPhone app for an existing web application. To give a brief overview, the iPhone app is a tab bar based application with each tab containing navigation controllers. At the moment the iPhone app is downloading data from the web app in a synchronous mode on the main thread that, of course, ti...

CoreData: How to sort NSManagedObject by its primary key?

I have one subclass of NSManagedObject like following and stored some instances by NSManagedObjectContext. @interface SomeModelObject : NSManagedObject @property (nonatomic, retain) NSString * text; @end Now, I want to fetch the list sorted by its primary key (created automatically). I've tried NSFetchRequest and got runtime er...

Core Data , NSFetchResultsController leaking

Hi, I am not sure if the leak is in my implementation or is it from apple's side.... Instruments indicate me that I have a leak in this line : if (![[self fetchedResultsController] performFetch:&error]) I am adding annotations by reading the fetchController to the Map.... like this : -(void)fillMapWithAnnotations{ NSError...

retain cycle with core-data

Hello, I think I have a problem, maybe linked to a retain cycle in Core-Data. The code is a follow, where self.image is also a NSManagedObject: - (void)setImage:(UIImage*)image1 andThumbnail:(UIImage*)image2 { self.image.data = UIImageJPEGRepresentation(image1, 0.85); // This is autoreleased self.thumbnail = UIImageJPEGRepresen...

Create sidebar in mac app with sections

Hi folks, I want to create a sidebar in one of my mac applications. Basically it will look much like the Things sidebar. Here is the picture that I basically want to recreate - http://i48.tinypic.com/c25ix.png I can't figure out how to show the "sections" (collect, focus and active projects) and how to have certain items always show u...

Out of memory when migrating models

I am migrating data from one model version to another in the iPhone, but the migration causes the device to run out of memory and crash. Not to mention it takes forever on the device. I use the default migration settings. I guess the bad guy is one of the tables that contain the order of 105 rows. This table has not changed though, but ...

working with core data which maintains primary key and foreign key relations in iphone app

hello all , I am developing Iphone app that reads data from url and after parsing i should save that data for persistance.(Because of getting app in offline also...). I want to use core data for this. Such that first time only we will read the data from url and save into objct model, so from second time onwards we can fetch the data fro...

Core data relationship delete action - cascade vs. nullify vs. deny vs. no action

Core Data is throwing me for a loop. I have two objects:, Card and CardSet, which are in a many-to-many relationship with each other, i.e. you could have cards 1, 2, and 3 in CardSet A and cards 2, 4, and 5 in CardSet B. I am trying to set up my delete actions so that: If I delete a Card, it is removed from all CardSets to which it be...

iPhone Core Data relationship fault

Hi, I am building a core data iphone app, and having trouble with retrieving one-many relationship data. Please bear with me while I explain. I have used the data model designer to setup an entity called "Item" that contains many entities called "Comment". I then retrieve multiple entities and display them in a UITableView. I fetch the...

Core Data client+server/background saving/general import question

I'm working on a Core Data-based application that has a Mac application acting as a 'server' and an iPhone as a client. Everything is going swimmingly, except I'm running into performance issues. When the user taps an object, the server must return some objects related to that object (nothing too heavy, usually 3-4 objects) and show a U...

Is CoreData typically used as the Model or is it an implementation detail of the Infrastructure?

I would like to use a Sqlite datbase in an iphone application. The example in the book I am reading has the controllers directly calling into CoreData objects. Coming from MVC/MVP in .NET to me this is akin to opening a SQL Connection in a button event handler. I would typically have a repository that handled the details of retrieving...

Accessing NSManagedObject fields with KVC/valueForKey vs properties - which is better?

Writing my first app with CoreData. The book I'm using to guide me has code like this: // 'Person' is my managed object class Person *newPerson = [NSEntityDescription insertNewObjectForEntityForName:@"Person" inManagedObjectContext:self.managedObjectContext]; [newPerson setValue:nameField.text forKey:@"name"]; The book says that...

tableview coredata temporary object

Hi, I am using a tableview with data from coredata using nsfetchedresultscontroller. When the view loads i make a new entity using SomeManagedObject *someManagedObject = [NSEntityDescription insertNewObjectForEntityForName:@"SomeManagedObject" inManagedObjectContext:self.managedObjectContext]; This way the new entity appears in my ta...

Core Data migration of more than one version at a time doesn't work?

Using Lightweight Migrations for my Core Data data model. Each update has gone smoothly…in the simulator. On my device, I had not gone through each migration one-by-one. For example, my device had version 3, and I was on version 5. On the simulator, I went from 3 to 4 and then from 4 to 5, but when the device attempted to go from 3 t...

UIAlertView and Core Data

Hi to all of stackoverflow, i'm Italian so, i'm sorry for my bad English... :D i tried to create a simple tableView for listing a few names and a number... all with core data. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { Track *track = [[self fetchedResultsController] objectAtIndexPat...

iPhone application - perform post-install tasks or pre-populate core data

Is there a way to perform operations during the install phase of an iPhone application? I think this would be the most ideal time to perform tasks such as populating data stores (using core data). Or is there a more convenient way to: pre-populate data perform post-install tasks ...

Problem inserting data into Coredata while parsing data on thread iphone sdk

Hi all, In my application I need to cache the data that's being parsed for which I'm using coredata and inserting it in managedobjectcontext on a thread which is performing the xml parsing function. So this thread is performing two things: parsing and inserting in coredata. I'm using the following function: -(void)saveData { self.man...

How to filter records in CoreData using NSPredicate

I have amount attribute in coredata model with string datatype. I need to find records by comparing amount. I have tried NSPredicate with following but nothing is coming and result is always empty. NSDecimal result; NSScanner *theScanner = [[NSScanner alloc] initWithString:@"10.00"]; [theScanner scanDecimal:&result]; [theScanner release...