As I understand it, we need to store references to our Cocoa objects when working with them in MonoTouch. The reason for this is that the ObjC runtime may contain references to objects, and if we don’t have “references to MonoTouch”, they can be garbage collected, which results in EXC_BAD_ACCESSas soon as the ObjC runtime tries to access them.
Say we have two subclasses of UIViewController, VC1 and VC2. If the user presses a button on VC1, the user interface switches to VC2, and the user can move forward and backward. If I create a new instance of VC2 every time a user navigates to it, links to old instances are lost, so they are garbage collected, and the application crashes the next time it is didReceiveMemoryWarningdistributed to UIViewControllers.
How can I free old links, so I don’t need to use the same instance of VC2 every time? Disposeseemed not enough.
source
share