2013-07-31 54 views
5

我正在使用Xamarin.IOS處理我的第一個真正的應用程序。大多數時候應用程序的偉大工程,但一天幾次將其與下面的堆棧跟蹤崩潰的:在Xamarin.iOS中查找SIGSEGV的原因應用程序

mono-rt: Stacktrace: 
mono-rt: at <unknown> <0xffffffff> 
mono-rt: at (wrapper managed-to-native) MonoTouch.Foundation.NSObject.monotouch_release_managed_ref (intptr) <IL 0x00023, 0xffffffff> 
mono-rt: at MonoTouch.Foundation.NSObject.ReleaseManagedRef() [0x00000] in /Developer/MonoTouch/Source/monotouch/src/Foundation/NSObject.cs:98 
mono-rt: at MonoTouch.Foundation.NSObject/NSObject_Disposer.Drain (MonoTouch.Foundation.NSObject) [0x00062] in /Developer/MonoTouch/Source/monotouch/src/shared/Foundation/NSObject2.cs:545 
mono-rt: at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object (object,intptr,intptr,intptr) <IL 0x00050, 0xffffffff> 
mono-rt: at <unknown> <0xffffffff> 
mono-rt: at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication.UIApplicationMain (int,string[],intptr,intptr) <IL 0x0009f, 0xffffffff> 
mono-rt: at MonoTouch.UIKit.UIApplication.Main (string[],string,string) [0x0004c] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:38 
mono-rt: at Diet52App.Application.Main (string[]) [0x00008] in /Users/danielnordmark/Projects/Diet52App/Diet52App/Main.cs:16 
mono-rt: at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object (object,intptr,intptr,intptr) <IL 0x00050, 0xffffffff> 

mono-rt: 
Native stacktrace: 


mono-rt: 
================================================================= 
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. 
================================================================= 

我的猜測是,有些對象結婚之前我試圖用它收集垃圾。但是我覺得有點失落,要知道我的代碼在何時何地發生這種事情。

如何找出問題所在?任何幫助深表感謝!

回答

4

這個問題似乎與我的UITableViewController有關,我有一個基類和兩個不同的實例。這兩者之間的衝突導致了SIGSEGV錯誤。

我管理的問題,由於跟蹤這個答案https://stackoverflow.com/a/6769885/248905

我不得不做出的唯一修改是包裝與InvokeOnMainThread這樣的代碼,

更新: 我更新了我的解決方案後,我曾在Xamarin與Rolf聯繫,正確的解決方法是將代碼放入ViewDidDissapear而不是Dispose。

public override void ViewDidDisappear (bool animated) 
{ 
    searchController.SearchResultsSource = null; 
    searchController.Delegate = null; 
    base.ViewDidDisappear (animated); 
}