Created
March 12, 2011 00:47
-
-
Save mikeabdullah/866873 to your computer and use it in GitHub Desktop.
How to make a managed object complain if it's being turned into a fault while KVO observers are still registered with it.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)willTurnIntoFault; | |
{ | |
[super willTurnIntoFault]; | |
if ([self observationInfo]) | |
{ | |
NSLog(@"%@ has observers:\n%@", [self objectID], [self observationInfo]); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
So, I know that this was posted quite a while ago, but I was just curious if you've ever run into any strange problems having this in your code? I just tried to insert this in all of my managed objects after finding one that was being observed after its context was destroyed. However, when I tried to run with this in all of my objects, I started crashing and don't quite understand why:
thread #3: tid = 0x76b3e, 0x000000010914fd7b libobjc.A.dylib`objc_release + 11, queue = 'NSManagedObjectContext 0x611000190cc0', stop reason = EXC_BAD_ACCESS (code=2, address=0x60406080018d)
Have you ever seen anything like this? It's not showing any observers or anything at this point. It was simply adding that code to my objects.
Thanks,
Jaime