Skip to content
This repository has been archived by the owner on Dec 5, 2019. It is now read-only.

Problem in EXTAspect with NSManagedObjects from CoreData #38

Open
Antol opened this issue Jul 11, 2013 · 2 comments
Open

Problem in EXTAspect with NSManagedObjects from CoreData #38

Antol opened this issue Jul 11, 2013 · 2 comments
Labels

Comments

@Antol
Copy link

Antol commented Jul 11, 2013

In CoreData entity (child of NSManagedObject) work little bit tricky. Doc says:

NSManagedObject uses dynamic class generation to support the Objective-C 2 
properties feature (see “Objective-C 2 Support”) by automatically creating a subclass of 
your class appropriate for your entity. This is also typically transparent to you, however 
whereas NSManagedObject’s class method returns your class, the Objective-C 
function object_getClass returns the dynamically-generated class.

This leads to the fact that in

- (void)adviseSetters:(void (^)(void))body property:(NSString *)property

property == nil

@Antol
Copy link
Author

Antol commented Jul 11, 2013

One way to fix it is replace object_getClass(self) with [self class] in

static void setterAdviceMethod (ffi_cif *cif, void *result, void **args, void *userdata)

But I'm not sure about it

@jspahrsummers
Copy link
Owner

Unfortunately, EXTAspect is not really supported code. It was mostly a proof-of-concept, and I really wouldn't recommend using it in production.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants