異常消息:NSInvalidArgumentException而提出ModalView
Objective-C exception thrown. Name: NSInvalidArgumentException Reason:
Application tried to present a nil modal view controller on target <Navigator: 0x1bed0d0>.
這裏是我的代碼:
partial void BtnTest (MonoTouch.Foundation.NSObject sender)
{
MFMailComposeViewController view = new MFMailComposeViewController();
view.SetToRecipients(new string[]{"[email protected]"});
view.SetMessageBody("Hier steht nun der zusammengestellt text :)", false);
//view.MailComposeDelegate = new CustomMailComposeDelegate();
view.SetSubject("Test");
view.Finished += (s,e)=>
{
this.NavigationController.DismissModalViewControllerAnimated(true);
};
this.BeginInvokeOnMainThread(()=>
{
this.NavigationController.PresentModalViewController(view, true);
});
}
它適用於iPad的模擬器,但不是在設備上。
如果@Jason答案沒有工作,那麼請張貼完整的堆棧跟蹤/崩潰日誌。 – poupou 2012-03-14 15:14:19