[MonoTouch] MonoTouch + action handler + simulator issue
chrisntr at gmail.com
Mon Dec 20 14:40:09 EST 2010
Your view controller is probably getting Garbage collected.
Change you Main.cs to look a little like this
// This method is invoked when the application has loaded
its UI and its ready to run
public override bool FinishedLaunching (UIApplication app, NSDictionary
viewController = new ViewController ();
On 20 December 2010 19:18, Brian Long <brian at blong.com> wrote:
> Hello all
> I've bumped into an issue whilst getting the hang of MonoTouch.
> It is easily demonstrable with a simple app with 2 buttons, one of which
> responds (trivially, via an alert) to a delegate set up in code, one of
> which responds to an action set up in IB.
> The delegate one works perfectly.
> The action button always makes the app crash with a null reference
> exception on first run in the simulator.
> If you close the simulator and re-run, then the same will happen.
> However... if you simply back re-invoke the app in the same simulator
> session and press the same button again, it behaves as expected and
> displays the alert.
> The stack trace is useless (to my eyes) in pointing the finger at anything
> (nothing in my source is pointed at) and I wonder if this is known (I have
> failed to find a reference to it in searches thus far), where the fault
> lies, and if it is avoidable (without avoiding actions in IB).
> I attach the trivial C# app that gives the problem, and also the stack
> trace I get when the action button is hit.
> FYI, I currently have no iPhone so cannot see the comparative behaviour on
> a real device - would be interesting to be reassured that the device
> behaves appropriately all the time.
> Any feedback on the matter would be welcomed
> - Brian
> MonoTouch mailing list
> MonoTouch at lists.ximian.com
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the MonoTouch