[MonoTouch] SDK 5 issue
Sergio Fadda
sergio.fadda at logobject.ch
Mon Oct 17 10:23:31 EDT 2011
Hi,
Trying to isolate an issue that I encountered in a project I'm working, I
found another problem (actually very similar to the initial one). Following
there is a small iPhone application that I compiled with the new MT 5.0
(Mono 2.10.6, XCode 4.2, MD 2.8.1... actually everything is updated):
using System;
using System.Drawing;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
namespace MTFailure
{
public class Application
{
static void Main (string[] args)
{
UIApplication.Main (args, null, "AppDelegate");
}
}
public class MyController : UIViewController
{
public MyController()
{
NavigationItem.RightBarButtonItem = new
UIBarButtonItem(UIBarButtonSystemItem.Action, HandleActionButton);
}
private void HandleActionButton(object sender, EventArgs evt)
{
UIView menuView = new UIView(UIScreen.MainScreen.Bounds);
UIToolbar toolbar = new UIToolbar(new RectangleF(0, 0, 320, 40));
toolbar.Items = new[]
{
new UIBarButtonItem(UIBarButtonSystemItem.Cancel, HandleCancelButton)
};
menuView.AddSubview(toolbar);
UIViewController menuCtrl = new UIViewController();
menuCtrl.View = menuView;
PresentModalViewController(menuCtrl, true);
}
private void HandleCancelButton(object sender, EventArgs evt)
{
DismissModalViewControllerAnimated(true);
}
}
[Register("AppDelegate")]
public class AppDelegate : UIApplicationDelegate
{
private MonoTouch.UIKit.UIWindow __mt_window;
private UITextField _txtField;
public override bool FinishedLaunching (UIApplication app, NSDictionary
options)
{
__mt_window = new UIWindow(UIScreen.MainScreen.Bounds);
__mt_window.BackgroundColor = UIColor.White;
MyController ctrl1 = new MyController();
UIView mainView = new UIView(UIScreen.MainScreen.Bounds);
UIToolbar toolbar = new UIToolbar(new RectangleF(0, 0, 320, 30));
toolbar.Items = new[]
{
new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace),
new UIBarButtonItem(UIBarButtonSystemItem.Done, HandleDoneButton)
};
_txtField = new UITextField(new RectangleF(10, 10, 300, 30));
_txtField.BorderStyle = UITextBorderStyle.RoundedRect;
_txtField.InputAccessoryView = toolbar;
mainView.AddSubview(_txtField);
ctrl1.View = mainView;
UINavigationController _navCtrl = new UINavigationController(ctrl1);
__mt_window.AddSubview(_navCtrl.View);
__mt_window.MakeKeyAndVisible ();
return true;
}
private void HandleDoneButton(object sender, EventArgs evt)
{
_txtField.ResignFirstResponder();
}
// This method is required in iPhoneOS 3.0
public override void OnActivated (UIApplication application)
{
}
}
}
Now, the issue can be replicated in different ways:
1) get the focus to the text field
2) tap the "Done" button (in the input accessory toolbar)
3) tap to the button in the navigation bar.
The other way is:
1) tap the button in the navigation bar
2) tap the "Cancel" button in the tollbar of the modal view
However, in both cases the following error message (slightly different from
the first test case to the second one) is the following:
Stacktrace:
at (wrapper managed-to-native)
MonoTouch.UIKit.UIApplication.UIApplicationMain (int,string[],intptr,intptr)
at MonoTouch.UIKit.UIApplication.Main (string[],string,string) [0x00042]
in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:29
at MTFailure.Application.Main (string[]) [0x00000] in
/Users/sergiofadda/Projects/MonoTest/GenericsFailure/GenericsFailure/Main.cs:12
at (wrapper runtime-invoke) .runtime_invoke_void_object
(object,intptr,intptr,intptr)
Native stacktrace:
0 MTFailure 0x000d5c18
mono_handle_native_sigsegv + 408
1 MTFailure 0x00012fcf
mono_sigsegv_signal_handler + 351
2 libsystem_c.dylib 0x9435859b _sigtramp + 43
3 ??? 0xffffffff 0x0 + 4294967295
4 UIKit 0x00c1cd54
-[UIBarButtonItem(UIInternal) _sendAction:withEvent:] + 145
5 CoreFoundation 0x01805ec9 -[NSObject
performSelector:withObject:withObject:] + 73
6 UIKit 0x009e15c2 -[UIApplication
sendAction:to:from:forEvent:] + 96
7 UIKit 0x009e155a -[UIApplication
sendAction:toTarget:fromSender:forEvent:] + 61
8 UIKit 0x00a86b76 -[UIControl
sendAction:to:forEvent:] + 66
9 UIKit 0x00a8703f -[UIControl(Internal)
_sendActionsForEvents:withEvent:] + 503
10 UIKit 0x00a862fe -[UIControl
touchesEnded:withEvent:] + 549
11 UIKit 0x00a06a30 -[UIWindow
_sendTouchesForEvent:] + 513
12 UIKit 0x00a06c56 -[UIWindow sendEvent:] +
273
13 UIKit 0x009ed384 -[UIApplication
sendEvent:] + 464
14 UIKit 0x009e0aa9
_UIApplicationHandleEvent + 8196
15 GraphicsServices 0x022a3fa9 PurpleEventCallback +
1274
16 CoreFoundation 0x017d81c5
__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 53
17 CoreFoundation 0x0173d022 __CFRunLoopDoSource1 +
146
18 CoreFoundation 0x0173b90a __CFRunLoopRun + 2218
19 CoreFoundation 0x0173adb4 CFRunLoopRunSpecific +
212
20 CoreFoundation 0x0173accb CFRunLoopRunInMode + 123
21 GraphicsServices 0x022a2879 GSEventRunModal + 207
22 GraphicsServices 0x022a293e GSEventRun + 114
23 UIKit 0x009dea9b UIApplicationMain + 1175
24 ??? 0x095a24d5 0x0 + 156902613
25 ??? 0x095a1758 0x0 + 156899160
26 ??? 0x095a1450 0x0 + 156898384
27 ??? 0x095a15a6 0x0 + 156898726
28 MTFailure 0x00012d1f mono_jit_runtime_invoke
+ 1407
29 MTFailure 0x0020a33a mono_runtime_invoke +
170
30 MTFailure 0x0020cf61 mono_runtime_exec_main +
705
31 MTFailure 0x0020c1b1 mono_runtime_run_main +
929
32 MTFailure 0x000a78cf mono_jit_exec + 239
33 MTFailure 0x00004cca main + 5194
34 MTFailure 0x00002085 start + 53
=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================
What's wrong with that?
Tnx in advance,
Sergio
--
View this message in context: http://monotouch.2284126.n4.nabble.com/SDK-5-issue-tp3912223p3912223.html
Sent from the MonoTouch mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/monotouch/attachments/20111017/318b984c/attachment-0001.html
More information about the MonoTouch
mailing list