Hi all,
I want to cache my loaded data so that I can reduce my application start time .
I know several strategies to store application data
i.e. core data, nsuserdefaults , archiving .
Now my scenario is that suppose that I have array of maximum 10 objects each object having 5 fields .
So I can not decide which strategy to store th...
What's the difference between getting an managed object with
- (NSManagedObject *)objectRegisteredForID:(NSManagedObjectID *)objectID
and
- (NSManagedObject *)existingObjectWithID:(NSManagedObjectID *)objectIDerror:(NSError **)error
Are there different types of NSManagedObjectID? Is there a difference between a "registered ID" and...
-objectWithID: is supposed to give me an object that's broken when the ID doesn't exist. The documentation says, that this object throws an exception when I try to access an property.
However, it never throws any. Must I enable exceptions so that they're really thrown?
Here's some code:
// Assume: a new managed object has been created...
What I'm trying is this:
1) Create a new manged object
2) Get it's temporary id with [myMO objectID];
3) Convert that ID to an NSURL, so I can save it for future reference:
NSManagedObjectID *moID = [myMO objectID];
NSURL *url = [moID URIRepresentation];
4) Save the managed object context
5) Some time later, fetch that object usi...
Example: I create a bunch of new NSManagedObject instances. Not stored yet, but already added to a managed object context. Then I want permanent IDs so I can refer back to those objects 10 years later. At this point, will these objects be actually saved to the persistent store?
I guess they have to - but I'm not sure how Core Data obtai...
Is there an explanation how this is done? Is Core Data creating dummy records to get IDs for not-yet-saved managed objects?
...
I did some little experimentation on this.
I created an boolean attribute, named isFault. You know, that's a method of NSManagedObject and therefore actually not allowed for an attribute name because of KVC.
Simply, I used the default Core Data template for this test, but created the data model programmatically so I can show you what ...
There's this Transformable data type for attributes. What is it good for? Are there good examples?
I'd like to play around with this. So after searching a while I came across this: NSValueTransformer. Seems to be something I need for this.
So how would I get started with this? For example, if I wanted to store an UIColor object, would ...
i.e. lets say I want to store a custom data type in Core Data. The documentation claims that the default NSValueTransformer is an NSKeyedUnarchiveFromDataTransformer thing, so I guess if the class of the object I want to store conforms already to that NSCoding protocol, I don't need to bother about making a custom NSValueTransformer? Is ...
In my Core Data model (on iPhone SDK 3.1) I have several entities that are associated with the same instance of an image. The image itself is also stored as managed object. In order to save disk space, I'm trying to create 1 db file for the images and another db file for all other objects.
Reading Apple's documentation and googling for ...
The data modeler generated this class for me:
@interface Cat : NSManagedObject
{
}
@property (nonatomic, retain) NSSet* event;
@end
@interface Cat (CoreDataGeneratedAccessors)
- (void)addEventObject:(NSManagedObject *)value;
- (void)removeEventObject:(NSManagedObject *)value;
- (void)addEvent:(NSSet *)value;
- (void)removeEvent:(...
Any idea why
//should save the object context.
NSError *error;
if (![managedObjectContext save:&error]) {
NSLog(@"SAVE ERROR");
}
when implemented in a view controller(accessed via a drill down tableview) won't properly save the information? I am passing the moc from the beginning (rootview hands off to tableview, tableview r...
In which situations would I want to call -processPendingChanges of NSManagedObjectContext?
...
Hi all,
I have a Core Data object called Car that has a one-to-many relationship with another Core Data object called Claims (i.e., one Car has many Claims). I've created the entities in the data model editor, and am able to list, edit, and work with the Car objects.
What I can't figure out is this: given a Car, how to get an array of...
I have a CoreData entity X, and controllers for this entity, XController.
Now there's another entity, XGroup, containing a collection of X entities, and a XGroupController.
Now the problem is that XGroupController needs to interact with XController, and it would be nice to just pass XGroupController a XGroup to observe, and then get th...
Why would I want to set that to YES? What difference would that make? Must I worry about this?
...
I try to grok this method. Is that only useful when I'm dealing with undo/redo operations? Or can I use that in general, when I have changed my object graph after saving it and then decide that that was a bad idea? So -rollback would go back to the last saved state of my object graph?
...
The documentation for the -reset method of NSManagedObjectContext is confusing...
All the receiver's managed objects are
“forgotten.” If you use this method,
you should ensure that you also
discard references to any managed
objects fetched using the receiver,
since they will be invalid afterwards.
So what does that mean? ...
Let me try it: If I don't set this, then the default value is YES. So when I delete an managed object from the context, the context propagates this immediately to the persistent store so the object is gone?
And when I set this to NO, then objects are deleted from the persistent store only when calling -save?
Is that really true? I mean...
When an managed object is fetched, and the staleness interval is set to 5 minutes, what happens after 10 minutes, when I access an property of that object?
Would Core Data then perform a fresh fetch request? Does that make sense? I can't think of a situation where data is already cached but the object is a fault. When can this happen?
...