[MonoTouch] SDK 5 issue
Nic Wise
nicw at fastchicken.co.nz
Mon Oct 17 11:06:51 EDT 2011
ignore the bit about __mt_window :) I thought you were using a XIB and
a partial class, which does this for you. (ie, how the default
template does it)
On Mon, Oct 17, 2011 at 16:06, Nic Wise <nicw at fastchicken.co.nz> wrote:
> Try moving all the declarations out of FinishedLaunching, eg:
>
>
>> private MonoTouch.UIKit.UIWindow __mt_window;
>> private UITextField _txtField;
>>
>>>>>>> THEY should be here!
>
> MyController ctrl1;
> UIView mainView;
> UIToolbar toolbar;
>
>
>
>> public override bool FinishedLaunching (UIApplication app, NSDictionary
>> options)
>> {
>> __mt_window = new UIWindow(UIScreen.MainScreen.Bounds);
>> __mt_window.BackgroundColor = UIColor.White;
>>
>
> why are you using __mt_window? use the window property, which talks to
>
>> MyController ctrl1 = new MyController();
>>
>> UIView mainView = new UIView(UIScreen.MainScreen.Bounds);
>>
>>>>> NOT HERE!
>
>
>> UIToolbar toolbar = new UIToolbar(new RectangleF(0, 0, 320, 30));
>> toolbar.Items = new[]
>> {
>> new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace),
>> new UIBarButtonItem(UIBarButtonSystemItem.Done, HandleDoneButton)
>> };
>>
>>>>> OR HERE - move UIToolbar out into a class-level variable
>
>
>
>> Native stacktrace:
>>
>> 0 MTFailure 0x000d5c18
>> mono_handle_native_sigsegv + 408
>
> SIGSEGV is a Signal for a Segment Violation.
>
> AKA a Null Pointer Exception.
>
> All those things above will be getting GC'ed before you get to use
> them. The GC in the newer version of MT is (I beleive) a LOT more
> agressive, so things going out of scope get cleaned up quickly.
> Putting them in as class var's stops that.
>
>
>
> N
>
> --
> Nic Wise
> t. +44 7788 592 806 | @fastchicken | http://www.linkedin.com/in/nicwise
> b. http://www.fastchicken.co.nz/
>
> Nearest Bus: find when the next bus is coming to your stop. http://goo.gl/Vcz1p
> 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
>
--
Nic Wise
t. +44 7788 592 806 | @fastchicken | http://www.linkedin.com/in/nicwise
b. http://www.fastchicken.co.nz/
Nearest Bus: find when the next bus is coming to your stop. http://goo.gl/Vcz1p
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
More information about the MonoTouch
mailing list