Make this

 DisplayIt2 d = new DisplayIt2();

an instance variable of the application delegate (ie move the decl out
of FinishedLaunching)

it's getting garbage collected early :)

On Thu, Jun 23, 2011 at 16:56, Brian Schuth <[email protected]> wrote:
> Despite the uncertain future of Monotouch, I went ahead and purchased a
> personal license the other day since I really had to start testing on real
> devices. Installation and activiation worked fine. While testing in my app,I
> hit a weird JIT problem involving LINQ. I was preparing a small test app to
> isolate the problem, when it seems that something very basic is broken in my
> setup.
> If I make a new solution, add a single view+controller to it, add a button
> to the controller, then try to put an event handler on the button, the app
> dies when debugging in the simulator in MonoDevelop with "Objective-C
> exception thrown. Name: NSInvalidArgumentException Reason: -[__NSArrayM
> BridgeSelector]: unrecognized selector sent to instance 0x758de50". The
> error occurs whether I choose Run|Debug or Run|Run.
> However,  same app runs fine in the simulator if I just start it there,
> rather than from MonoDevelop. I am able to access the button to change its
> Title without any error; it is just event handling that appears broken.
> Any ideas? My only plan right now is to figure out how to uninstall
> MonoDevelop and MonoTouch, and then reinstall, figuring that some plumbing
> broke when I installed the real MonoTouch over the trial.
> Some sample code below, just to show how simple the whole thing is. Thanks.
> In main.cs:
> public override bool FinishedLaunching (UIApplication app, NSDictionary
> options)
> {
> DisplayIt2 d = new DisplayIt2();
> window.AddSubview (d.View);
> window.MakeKeyAndVisible ();
> return true;
> }
> In the DisplayIt2 controller:
> public override void ViewDidLoad ()
> {
> // the following line executes OK, so the outlet is found and
> // connected OK
> btnDo.SetTitle("foobar", UIControlState.Normal);
> base.ViewDidLoad();
> btnDo.TouchUpInside += HandleBtnDoTouchUpInside;
> }
> // When I click, I never get here. The exception is reported
> // as occurring in UIApplicationMain
> void HandleBtnDoTouchUpInside (object sender, EventArgs e)
> {
> btnDo.SetTitle("bazbam", UIControlState.Normal);
> }
> --
> Brian Schuth
> ALPHCE, Inc.
> Eastport, ME
> +1 207 370 2430
> [email protected]
>
> _______________________________________________
> MonoTouch mailing list
> [email protected]
> http://lists.ximian.com/mailman/listinfo/monotouch
>
>



-- 
Nic Wise
t.  +44 7788 592 806 | @fastchicken | http://www.linkedin.com/in/nicwise
b. http://www.fastchicken.co.nz/ | http://www.flickr.com/photos/nicwise

mobileAgent (for FreeAgent): get your accounts in your pocket.
http://goo.gl/IuBU
Trip Wallet: Keep track of your budget on the go: http://goo.gl/ePhKa
London Bike App: Find the nearest Boris Bike, and get riding! http://goo.gl/Icp2
_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch

Reply via email to