core-data

CoreData: Fetching an Object from an unsaved Context

Hi, after I insert a ManagedObject into a context I'd like to fetch it later but before saving the context (I'd save after all objects are inserted). It appears that querying the context later with a fetch concerning those objects returns nothing if the context wasn't previously saved. Is there a way to save only in the end ?(I guess i ...

Using BWOrderedManagedObject with NSFetchedResultsController

I would like to use BWOrderedManagedObject to store an array of ordered objects in Core Data, using NSFetchedResultsController for displaying the data. However, all of BWOrderedManagedObject's methods seem to simply return an array of ordered objects; NSFetchedResultsController requires an NSFetchRequest, and the only way to sort an NSF...

Saving array of object in core data

Hello, My iphone app retrieve data from a RestServer in the following format: { data => ( { date => "20100710T12:21:23+02:00", value => 0.1 }, { date => "20100710T12:30:23+02:00", value => 25 }, ... { date => "20100710T15:2...

how can I put all fetch requests in a Core Data DAL?

Totally new to Objective-C and Core Data, coming from a .net background I really want to put all of my fetch requests into some sort of class that I can call, preferably statically to get my objects, something like: ObjectType *myObject = [CoreDataDAL GetObject:ID]; Anyone have a pattern to implement this? I am hacking my way through ...

Core Data memory management

Just want to make sure I'm doing right things with memory management of Core Data. In my view controller's (which is tab bar view) viewDidLoad I use NSFetchRequest to retrieve the rows I need. Then I retain returned NSArray object, since I need to wait for user interaction to show the part of this data. In viewDidUnload I release that a...

Index of item within NSCollectionView

In my collection view I need to generate an index for each item. As Items get reordered I need this index to update with its new position. The data are Core Data entities in a managed NSArrayController. The closest I have come to a possible solution is implementing this method on the entity class and then using representedObject.dynamic...

iPhone Core Data Migration With Multiple Models

Hi, I have two models at my project, I want to allow versions to one of them. Here's what I did: Selected the modelOne.xcdatamodel then Design > Data Model > Add Model Version. Clicked command + i then add version to modelOne.xcdatamodel inside modelOne.xcdatamodeld Modified modelOne.xcdatamodel, just added some attribute. At the del...

Unit Testing Core Data - exited abnormally with code 134

Hello all, I am setting up unit testing for my core data app. I'm running into a strange problem in a pretty simple test. The error I'm getting is: /Developer/Tools/RunPlatformUnitTests.include:451:0 Test rig '/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/Developer/usr/bin/otest' exited abnormall...

Bind Top 5 Values of a To-Many Core Data Relationship to Text Fields

Hi, I am making an application that represents a cell phone bill using Core Data. I have three entities: Bill, Line, and Calls. Bills can have many lines, and lines can have many calls. All of this is set up with relationships. Right now, I have a table view that displays all of the bills. When you double click on a bill, a sheet comes ...

preparing a core data result set for a grouped uitableview

hi everyone, i've got a NSMutableArray created from a data source object NSMutableArray *mutableFetchResults = [[managedObjectContext executeFetchRequest:request error:&error] mutableCopy]; [self setAmountArray: mutableFetchResults]; every object in my mutable array has the two instance variables name and timeadded. now i want to ...

Cocoa CoreData and non-Document-Based Application

Hi all, i have a Problem wich drives me crazy... I want to "write" a Cocoa CoreData Application, write is not the exact term, because the Application should be created with Bindings. It was no Problem to create a Document-Based Application, it works fine. But i want a Non-Document-Based Application, so I thought "Do the same like at th...

'NSFetchedResultsController does not support both change tracking and fetch request's with NSDictionaryResultType'

I have an application that was running just fine under OS3+. But it does not work under OS4. I get the following error message : 'NSFetchedResultsController does not support both change tracking and fetch request's with NSDictionaryResultType' Does it ring a bell to anyone here? (NSFetchedResultsController *)fetchedResultsController {...

Core Data Memory Leak - iPhone iOS4

Hi guys, I desperately need help with a memory leak in my iPhone app. The app is ready to submit to the app store, is stable, has no memory leaks at all in iPhone simulator or Clang ... but seems riddled with them on my iPod Touch. They all seem to stem from managedObjectModel when I'm trying to retrieve data from Core Data. The Core...

Error Building Core Data Stack in Unit Tests

Hello, I am trying to get started with unit testing an app that uses Core Data. In the setUp method of my unit first test, I can get the path to my data model but for some reason cannot convert it to a NSURL. My setUp method is: - (void)setUp { NSBundle *bundle = [NSBundle bundleWithIdentifier:@"com.testcompany.LogicTests"]; ...

NSObject PerformSelector Issue

Hooooookay so here's another "I just have no idea what's going on" problem: The first time I make a call to getFullWL() below, I get all my values as expected. Each subsequent call, however, returns nan instead of the true value(-nan(0x400000000) in XCode or something) Furthermore, if I put my "debug" lines in SFLog the value prints a...

iPhone SDK: Core Data and uniquing?

Either I'm not understanding what the term "uniquing" means in Core Data, or I'm not fetching my data properly. I have a pretty simple data model. Three entities: Community, Asset, and Category. Each Community has a relationship to multiple categories. Each category has a relationship to multiple assets. Each asset that is created m...

How to get the ID of an object saved to Core Data's managed object context?

I have this code: NSEntityDescription *userEntity = [[[engine managedObjectModel] entitiesByName] objectForKey:@"User"]; User *user = [[User alloc] initWithEntity:userEntity insertIntoManagedObjectContext:[engine managedObjectContext]]; and I want to know the id of the object inserted to the managed object context. How can i get that?...

whats the best way to store a single object in core data for a user

I have a simple iPhone app which accesses some remote data on start-up then asks the user to select one of the options chosen, but this happens each time the app starts, and I want the app to remember that choice for next time around, how can I persist this object using Core Data? Im very new to Core Data, and I figure its something to ...

Delay UITableView update when NSFetchedResultsController is updated due to NSManagedObjectContext save

I am sorting the UITableView by using a predicate with NSFetchedResultsController. But, when I make a change in a detail view and save it, the object I changed immediately gets placed in its new location in the UITableView. I have up/down buttons similar to the message view in Mail. This behavior disrupts the ordering of items, and I'd ...

traverse Core Data object graph with added predicate?

I want to load a client object and then pull their related purchase orders based on whether they have been placed or not, purchase orders have an IsPlaced BOOL property. So I have my client object and I can get all purchase orders like this, which is working great: purchaseordersList =[[myclient.purchaseorders allObjects] mutableCopy];...