KVO/KVC crash on reloading previously unloaded bundles?

Up vote 2 down vote favorite share g+ share fb share tw.

I'm running into an issue with loadable bundles and KVO. It seems that any class that has KVO observers attached to an instance of it cannot be safely be unloaded via NSBundle's -unload method. I'm doing the following: for (int I = 0; I Name = @"jim"; The loop gets through a number of iterations, sometimes crashing on the second time round, sometimes on the thirtieth.

It always crashes with this backtrace, with the EXC_BAD_ACCESS signal. #0 0x00007fff8a30deab in objc_msgSend () #1 0x00007fff8609d862 in NSKeyValueNotifyObserver () #2 0x00007fff860be99b in NSKeyValueDidChange () #3 0x00007fff8606b0fb in -NSObject(NSKeyValueObserverNotification) didChangeValueForKey: () #4 0x00000001007a4c2c in -Bundle init (self=0x101902130, _cmd=0x7fff8ea369b0) at /Users/joerick/Desktop/bundleTest/testbundle/Bundle. M:26 #5 0x0000000100001731 in -SIAppDelegate applicationDidFinishLaunching: (self=0x100326a90, _cmd=0x7fff876e285f, aNotification=0x100131ea0) at /Users/joerick/Desktop/bundleTest/bundleTest/SIAppDelegate.

M:28 #6 0x00007fff8606ade2 in __-NSNotificationCenter addObserver:selector:name:object:_block_invoke_1 () #7 0x00007fff8b470e0a in _CFXNotificationPost () #8 0x00007fff86057097 in -NSNotificationCenter postNotificationName:object:userInfo: () #9 0x00007fff8e1bbaa7 in -NSApplication _postDidFinishNotification () #10 0x00007fff8e1bb80d in -NSApplication _sendFinishLaunchingNotification () .... Full code here You can download a sample project showing this issue here. I'm thinking that this is a bug in Cocoa, but I wonder if anybody could see if I'm doing anything stupid here? Objective-c cocoa key-value-observing foundation kvc link|improve this question asked Feb 11 at 13:24joerick2,67138 100% accept rate.

I've reported this to Apple. Rdar://11017946.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions