App crashes when I try to inherit from UIAlertView. See stack trace and sample
code below. MonoTouch 5.0.
Any ideas? I have a sample app that shows this for anyone interested.
public class ViewController : UIViewController
{
private DateTimePickerView _pickerView;
public ViewController ()
{
}
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
new NotReachableAlertView ().Show ();
}
}
public class NotReachableAlertView : UIAlertView
{
public NotReachableAlertView() : base("Title", "Message", null, "Cancel")
{
}
}
Unhandled Exception: MonoTouch.Foundation.MonoTouchException: Objective-C
exception thrown. Name: NSInternalInconsistencyException Reason: Requesting
the window of a view (<PickerViewCrash.NotReachableAlertView: 0x79a700;
baseClass = UIAlertView; frame = (0 0; 0 0); transform = [0, 0, 0, 0, 0, 0];
alpha = 0; opaque = NO; layer = (null)>) with a nil layer. This view probably
hasn't received initWithFrame: or initWithCoder:.
at MonoTouch.UIKit.UIAlertView.Show () [0x00000] in <filename unknown>:0
at PickerViewCrash.ViewController.ViewDidLoad () [0x00006] in
/Users/Andrew/Projects/PickerViewCrash/ViewController.cs:20
at MonoTouch.UIKit.UIWindow.MakeKeyAndVisible () [0x00000] in <filename
unknown>:0
at PickerViewCrash.AppDelegate.FinishedLaunching
(MonoTouch.UIKit.UIApplication app, MonoTouch.Foundation.NSDictionary options)
[0x00031] in /Users/Andrew/Projects/PickerViewCrash/AppDelegate.cs:32
at MonoTouch.UIKit.UIApplication.Main (System.String[] args, System.String
principalClassName, System.String delegateClassName) [0x00000] in <filename
unknown>:0
at PickerViewCrash.Application.Main (System.String[] args) [0x00000] in
/Users/Andrew/Projects/PickerViewCrash/Main.cs:16
[ERROR] FATAL UNHANDLED EXCEPTION: MonoTouch.Foundation.MonoTouchException:
Objective-C exception thrown. Name: NSInternalInconsistencyException Reason:
Requesting the window of a view (<PickerViewCrash.NotReachableAlertView:
0x79a700; baseClass = UIAlertView; frame = (0 0; 0 0); transform = [0, 0, 0, 0,
0, 0]; alpha = 0; opaque = NO; layer = (null)>) with a nil layer. This view
probably hasn't received initWithFrame: or initWithCoder:.
at MonoTouch.UIKit.UIAlertView.Show () [0x00000] in <filename unknown>:0
at PickerViewCrash.ViewController.ViewDidLoad () [0x00006] in
/Users/Andrew/Projects/PickerViewCrash/ViewController.cs:20
at MonoTouch.UIKit.UIWindow.MakeKeyAndVisible () [0x00000] in <filename
unknown>:0
at PickerViewCrash.AppDelegate.FinishedLaunching
(MonoTouch.UIKit.UIApplication app, MonoTouch.Foundation.NSDictionary options)
[0x00031] in /Users/Andrew/Projects/PickerViewCrash/AppDelegate.cs:32
at MonoTouch.UIKit.UIApplication.Main (System.String[] args, System.String
principalClassName, System.String delegateClassName) [0x00000] in <filename
unknown>:0
at PickerViewCrash.Application.Main (System.String[] args) [0x00000] in
/Users/Andrew/Projects/PickerViewCrash/Main.cs:16
Terminating runtime due to unhandled exception
_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch