Note that there are some explanatory texts on larger screens.

plurals
  1. POProblem with NavigationItem RightBarButtonItem after last update
    primarykey
    data
    text
    <p>After the last update (4.0.0) I am having an issue and was wondering of this is a bug and is there a fix. </p> <p>As you can see from the code below, I am creating a NavigationItem.RightBarButtonItem and adding a delegate to the TouchUpInside event. The button is created but when the touch occurs, the app dies a horribly(see below). Before this update the code ran perfect.</p> <p>Anyone has any idea? Monotouch team, are you aware of this issue? Maybe I just coded incorrectly and worked before, but the new update has proven I was coding incorrect.</p> <p>Regards,</p> <p>Danny</p> <h2>CODE</h2> <pre><code> //start by creating the view RectangleF f = new RectangleF(0f,0f,38f,38f); UIView v = new UIView(f); //Now create a button with a background UIButton b = new UIButton(f); b.SetBackgroundImage(UIImage.FromFile("Images/Common/info.png"),UIControlState.Normal); //add the button to the view v.Add(b); b.TouchUpInside //give teh button a delegate action b.TouchUpInside += delegate { //var vc3 = new iPhone_HomeView(); //var vc3 = new iPhone_RetardView(); //vc3.Title = "asdasd"; //this.NavigationController.PushViewController (vc3, true); }; //now apply the view to the navigation bar on the right NavigationItem.RightBarButtonItem = new UIBarButtonItem(v); NavigationItem.RightBarButtonItem.Width = 38f; </code></pre> <h2>ERROR</h2> <p>Stacktrace:</p> <p>at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication.UIApplicationMain (int,string[],intptr,intptr) at MonoTouch.UIKit.UIApplication.Main (string[],string,string) [0x00038] in /Users/plasma/Source/iphone/monotouch/UIKit/UIApplication.cs:26 at MonoTouch.UIKit.UIApplication.Main (string[]) [0x00000] in /Users/plasma/Source/iphone/monotouch/UIKit/UIApplication.cs:31 at SmartPhoneSolution.Application.Main (string[]) [0x00000] in /Users/aprdev/Projects/SmartPhoneSolution/SmartPhoneSolution/Main.cs:15 at (wrapper runtime-invoke) .runtime_invoke_void_object (object,intptr,intptr,intptr) </p> <p>Native stacktrace:</p> <pre><code>0 SmartPhoneSolution1 0x000d0db5 mono_handle_native_sigsegv + 343 1 SmartPhoneSolution1 0x0000f80c mono_sigsegv_signal_handler + 322 2 libSystem.B.dylib 0x996fb45b _sigtramp + 43 3 ??? 0xffffffff 0x0 + 4294967295 4 UIKit 0x01b92de0 -[UIControl sendAction:to:forEvent:] + 67 5 UIKit 0x01b95262 -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 527 6 UIKit 0x01b93e0f -[UIControl touchesEnded:withEvent:] + 458 7 UIKit 0x01b2b3d0 -[UIWindow _sendTouchesForEvent:] + 567 8 UIKit 0x01b0ccb4 -[UIApplication sendEvent:] + 447 9 UIKit 0x01b119bf _UIApplicationHandleEvent + 7672 10 GraphicsServices 0x05768822 PurpleEventCallback + 1550 11 CoreFoundation 0x00debff4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52 12 CoreFoundation 0x00d4c807 __CFRunLoopDoSource1 + 215 13 CoreFoundation 0x00d49a93 __CFRunLoopRun + 979 14 CoreFoundation 0x00d49350 CFRunLoopRunSpecific + 208 15 CoreFoundation 0x00d49271 CFRunLoopRunInMode + 97 16 GraphicsServices 0x0576700c GSEventRunModal + 217 17 GraphicsServices 0x057670d1 GSEventRun + 115 18 UIKit 0x01b15af2 UIApplicationMain + 1160 19 ??? 0x0ba72744 0x0 + 195503940 20 ??? 0x0ba7267a 0x0 + 195503738 21 ??? 0x090bfb9e 0x0 + 151780254 22 ??? 0x090bfaea 0x0 + 151780074 23 ??? 0x090bfb75 0x0 + 151780213 24 SmartPhoneSolution1 0x0000f5c7 mono_jit_runtime_invoke + 1332 25 SmartPhoneSolution1 0x001ed281 mono_runtime_invoke + 137 26 SmartPhoneSolution1 0x001ef968 mono_runtime_exec_main + 669 27 SmartPhoneSolution1 0x001eed52 mono_runtime_run_main + 843 28 SmartPhoneSolution1 0x000a3153 mono_jit_exec + 200 29 SmartPhoneSolution1 0x002a16b8 main + 4155 30 SmartPhoneSolution1 0x00002949 _start + 208 31 SmartPhoneSolution1 0x00002878 start + 40 </code></pre> <p>Debug info from gdb:</p> <p>/tmp/mono-gdb-commands.WL0ypx:1: Error in sourced command file: unable to debug self</p> <p>================================================================= Got a SIGSEGV while executing native code. This usually indicates a fatal error in the mono runtime or one of the native libraries </p> <h1>used by your application.</h1> <p>Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr) at MonoTouch.UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00038] in /Users/plasma/Source/iphone/monotouch/UIKit/UIApplication.cs:26 at MonoTouch.UIKit.UIApplication.Main (System.String[] args) [0x00000] in /Users/plasma/Source/iphone/monotouch/UIKit/UIApplication.cs:31 at SmartPhoneSolution.Application.Main (System.String[] args) [0x00000] in /Users/aprdev/Projects/SmartPhoneSolution/SmartPhoneSolution/Main.cs:15 </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload