Application crashes when launching an event only in MonoTouch 4.0.1?

When I look at your Main.cs file you have a pattern, except one of the things is reversed.

Up vote 1 down vote favorite share g+ share fb share tw.

I have an application working under MonoTouch 3.2.6; the same application, under MonoTouch 4.0.1, crashes when launching any touch event. Reading another question, at source, I understand that the problem lies in an object collected from the GC, but I can't see which one is. The application starts and loads dinamically the TabBar, but clicking on any TabItem crashes the app.

The files main.cs and TabDelegate.cs are listed below: Main.cs: using System; using System.Collections. Generic; using System. Linq; using System.

Threading; using MonoTouch. Foundation; using MonoTouch. UIKit; using System.

Drawing; using IPadApp. Classes; using AggiornamentiCL; namespace VSViewer { public class Application { static void Main (string args) { UIApplication. Main (args); } } // The name AppDelegate is referenced in the MainWindow.

Xib file. Public partial class AppDelegate : UIApplicationDelegate { public static UITabBar tabmain ; public static UIViewController ctrMain; public static Home ctrHome; public static UIView viewMain; public static WrapperMenu MenuManager; public static WrapperValueStories ValueStoriesManager; public static WrapperBibliography BibliographyManager; public static WrapperStakeHolder StakeHolderManager; public static Aggiornamento AggiornamentoManager; public static string RegionId = ""; public static string RegionName= ""; public override bool FinishedLaunching (UIApplication app, NSDictionary options) { // Reperisco il RegionName dai settings RegionName= NSUserDefaults. StandardUserDefaults.

StringForKey("regione"); // Inizializzo le variabili tabmain = tabMain; ctrMain = ctrmain; viewMain = viewContent; ctrHome = new Home(String. Empty, RegionName); // Inizializzo I manager MenuManager= new WrapperMenu(); ValueStoriesManager= new WrapperValueStories(ref viewMain); BibliographyManager = new WrapperBibliography(); StakeHolderManager = new WrapperStakeHolder(); AggiornamentoManager = new Aggiornamento(ctrMain); // Imposto I delegati tabmain. Delegate = new TabDelegate(viewMain, ctrMain, MenuManager, ValueStoriesManager, BibliographyManager, StakeHolderManager, AggiornamentoManager); // Reperisco il Root Menu MenuManager.

GetRootMenu(ref tabmain); if(string. IsNullOrEmpty(RegionName) || String. IsNullOrEmpty(Utils.

GetRegionIDByName(RegionName))) MenuManager. SoloRegioni(ref tabmain,false); else { RegionId = Utils. GetRegionIDByName(RegionName); Utils.

LoadSplash(viewMain,"",RegionName); } // If you have defined a view, add it here: window. AddSubview (ctrMain. View); window.

MakeKeyAndVisible (); Thread tAggiornaDati = new Thread(new ThreadStart( Aggiornamento. AggiornaDati)); tAggiornaDati.Start(); return true; } } } TabDelegate.cs: using System; using MonoTouch. Foundation; using MonoTouch.

UIKit; using IPadApp. Classes; using System.Collections. Generic; using System.

Linq; using System. Drawing; namespace VSViewer { public class TabDelegate : UITabBarDelegate { private WrapperMenu MenuManager; private WrapperValueStories ValueStoriesManager; private WrapperBibliography BibliographyManager; private WrapperStakeHolder StakeHolderManager; private Aggiornamento AggiornamentoManager; private UIView viewMain; //private UIViewController ctrmain; private NodeAction previousAction ; private int previousNode=0; public TabDelegate (UIView pviewMain, UIViewController pctrMain, WrapperMenu pMenuManager, WrapperValueStories pValueStoriesManager, WrapperBibliography pBibliographyManager, WrapperStakeHolder pStakeHolderManager, Aggiornamento pAggiornamento) { viewMain = pviewMain; MenuManager = pMenuManager; ValueStoriesManager = pValueStoriesManager; BibliographyManager= pBibliographyManager; StakeHolderManager = pStakeHolderManager; AggiornamentoManager = pAggiornamento; } private int GetSelectedTabBarIndex (UITabBar tabbar, UITabBarItem item) { for (int I = 0; I Itemsi) return i; } return -1; } public override void ItemSelected (UITabBar tabbar, UITabBarItem item) { int itemSelectedIndex = GetSelectedTabBarIndex (tabbar, item); MerqurioMenuNode currentNode = MenuManager. GetCurrentNodeByPos (itemSelectedIndex); if (!(previousAction==currentNode.

Action && previousNode == currentNode. MenuID) || currentNode. Action== NodeAction.

OpenSubMenu) { // Rimuovo tutte le immagini della VS che sto abbandonando if (previousAction== NodeAction. OpenValueStory) ValueStoriesManager.RemoveAllSlides(); // Detacho la View dell'azione precedente foreach (UIView subView in this.viewMain. Subviews) { subView.

RemoveFromSuperview (); subView.Dispose(); } // Mostro la view corretta switch (currentNode. Action) { case NodeAction. OpenSubMenu: MenuManager.

GetMenuByNodeId (ref tabbar, itemSelectedIndex); // Imposto la breadcrumb if (currentNode. ParentMenuID==0 && currentNode. Direction== NodeDirection.

Forward) Breadcrumb. SetMolecola(currentNode. ViewLabel); else if (currentNode.

ParentMenuID==0 &¤tNode. Direction== NodeDirection. Backward) Breadcrumb.

SetMolecola(""); Breadcrumb. UpdateBreadcrumb(currentNode. ViewLabel, AppDelegate.

RegionName); // Mostro la Splash Utils. LoadSplash(viewMain,currentNode. ViewLabel,AppDelegate.

RegionName); break; case NodeAction. OpenValueStory: ValueStoriesManager. ShowValueStory (currentNode, AppDelegate.

RegionId); break; case NodeAction. OpenBibliography: BibliographyManager. ShowBibliography(viewMain,currentNode.

FileName); break; case NodeAction. OpenStakeHolder: StakeHolderManager. ShowStakeHolder(viewMain); break; case NodeAction.

OpenRegion: Regioni ctrRegioni = new Regioni(); this.viewMain. AddSubview(ctrRegioni. View); break; case NodeAction.

OpenSimulator1: Simulator_1 ctrSimulator1 = new Simulator_1(); this.viewMain. AddSubview(ctrSimulator1. View); break; case NodeAction.

OpenSimulator2: Simulator_2 ctrSimulator2 = new Simulator_2(); this.viewMain. AddSubview(ctrSimulator2. View); break; case NodeAction.

OpenAggiornamento: this.viewMain. AddSubview(AggiornamentoManager. View); break; default: break; } } // Aggiorno I contatori previousAction = currentNode.

Action; previousNode = currentNode. MenuID; } } } Please help.. I can't found either the old file for MonoTouch 3.2.6... mono crash monotouch monodevelop link|improve this question edited Apr 26 '11 at 15:53Geoff Norton4,0211512 asked Apr 26 '11 at 15:48Vik89111.

When I look at your Main.cs file you have a pattern, except one of the things is reversed. **tabmain = tabMain**; ctrMain = ctrmain; viewMain = viewContent; I think you probably meant tabMain = tabmain.

I'm not the author of the code. I know it seems strange, or confusing, but the code is correct. As you can see, the declarations (public static) are tabman, ctrMain and viewMain.. while tabMain,ctrmain and viewContent are outlets declared in Interface Builder.. – Vik89 Apr 27 '11 at 6:40.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions