In Core Data, most of the time relationships are modeled bidirectional. But the docs say in another place:
It typically only makes sense to model
a to-one relationship in one
direction.
...
Hobbyist Cocoa programmer here. Have been looking around all the usual places, but this seems relatively under-explained:
I am writing something a little out of the ordinary. It is much simpler than, but similar to, a desktop publishing app. I want editable text boxes on a canvas, arbitrarily placed.
This is document-based and I’d real...
I'm developing an iPhone application using Core Data. I had everything working and had to make an adjustment to the database schema and change the relationships through the xcdatamodel file. I deleted the my project's sqlite file in Library/Application Support/iPhone Simulator/3.1.3//Documents. Build and run the application, it creates t...
Hi,
I have a Core Data Entity which has three properties startDate, endDate and duration. All three properties are persistent properties. I would like to know how I can calculate and update the duration property whenever the value for startDate and endDate changes?
BTW, I won't be able to make the duration as transient property since I ...
Hi,
I did some changes to my model (but I don't want migration yet, so I just remove the application, built clean etc.)
However, when I run it on the iPhone or in the simulator, I get the following error:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'executeFetchRequest:error: A fetch request mus...
How can I gain access to Core Data objects from Javascript/WebKit on Mac OS X? I've made custom subclasses of NSManagedObject for each of my tables, with accessors defined using @property/@dynamic for each attribute, but neither isSelectorExcludedFromWebScript: or isKeyExcludedFromWebScript: is called for any of them, so Javascript just...
From the docs:
If you change the input value in a
validate:error: method, you must
ensure that you only change the value
if it is invalid or uncoerced. The
reason is that, since the object and
context are now dirtied, Core Data may
validate that key again later. If you
keep performing a coercion in a
validation method...
For example, in the docs a KVC-style validation method is implemented like this:
-(BOOL)validateAge:(id *)ioValue error:(NSError **)outError
They used id* as the type for ioValue. Since that's not part of the method signature, I wonder if it would hurt to do something like:
-(BOOL)validateAge:(NSNumber *)ioValue error:(NSError **)out...
Core Data is calling these methods in certain situations:
- (BOOL)validateForInsert:(NSError **)outError;
- (BOOL)validateForUpdate:(NSError **)outError;
- (BOOL)validateForDelete:(NSError **)outError;
I wonder if they're doing anything different, or if they're essentially doing the exact same things.
As far as I know, these methods ...
An Employee has an inverse relationship to it's Department and vice versa. The Employee entity has an Relationship called department, and it has a DENY delete rule. Employee shall be deleted. Now: Does DENY actually deny deletion of employee, because department is still referencing a Department? Or does it mean that a Department can't be...
Lets say I have an employees relationship in an Company entity, and it's to-many. And they're really many. Apple in 100 years, with 1.258.500.073 employees.
Could I simply do something like
NSInteger numEmployees = [apple.employees count];
without firing 1.258.500.073 faults? (Well, in 100 years, the iPhone will easily handle so man...
I'm curious. Apple says in the docs:
Core Data automatically fires faults
when necessary (when a persistent
property of a fault is accessed).
However, firing faults individually
can be inefficient, and there are
better strategies for getting data
from the persistent store (see “Batch
Faulting and Pre-fetching with the
...
Does it turn some managed objects into faults when there's a Low Memory Warning? Or must we do that manually by calling the -refreshObjects:mergeChanges: method which puts the affected managed objects on diet quickly? And...would that actually hurt? What if these objects are currently used by an NSFetchedResultsController to show up on a...
Because: Core Data owns the life cycle, and it can turn them into a fault at any time today or tomorrow. And probably it won't care much about the retainCount. So I'm curious if retaining managed objects
1) makes any sense
2) or how bad it is, and why it is bad
...
From the docs:
Note: Core Data avoids the term
unfaulting because it is confusing.
There's no “unfaulting” a virtual
memory page fault. Page faults are
triggered, caused, fired, or
encountered. Of course, you can
release memory back to the kernel in a
variety of ways (using the functions
vm_deallocate, munmap, or sbrk...
From the docs:
When Core Data turns an object into a
fault, key-value observing (KVO)
change notifications (see Key-Value
Observing Programming Guide) are sent
for the object’s properties. If you
are observing properties of an object
that is turned into a fault and the
fault is subsequently realized, you
receive chang...
I watched a free high quality video with Aaron Hillegass about Core Data vs Tokyo Cabinet. Besides that this guy is amazingly funny (really, if you want to laugh now, watch it!), he shows off Tokyo Cabinet beeing about 40x faster than Core Data.
I wonder if it's worth thinking about how to attach this to Core Data? Does that make any se...
I have a one-to-many relationship where each department has many employees. When I create a new employee object I just link it to the parent department manually by setting the property to the instance of the department I have fetched from my fetch request. However, this seems to be improper because when I try to access the set of employ...
My iphone app plays a slide show made up of 5 user images. These images are stored using core data. I was noticing that memory was building up every time a different slide show was played and it was not releasing any of the previously played slide shows.
These images are showing up in Object Allocations as CFData. So I tried releasin...
Hello,
I have a UITableView displaying an underlying NSFetchedResultsController.
When the fetchedResultsController is updated,
- (void)controller:(NSFetchedResultsController *)controller didChangeObject:(id)anObject atIndexPath:(NSIndexPath *)indexPath forChangeType:(NSFetchedResultsChangeType)type newIndexPath:(NSIndexPath *)newInde...