我有两个视图控制器A和B.从A,我导航到视图控制器B,如下所示:
// in View Controller A
// navigateToB method
-(void) navigateToB {
BViewController *bViewController =
[[BViewController alloc] initWithNibName: @"BView" bundle:nil];
bViewController.bProperty1 = SOME_STRING_CONSTANT;
bViewController.title = @"A TITLE OF A VC's CHOOSING";
[self.navigationController pushViewController: bViewController animated:YES];
[bViewController release]; //<----- releasing 0x406c1e0
}
Run Code Online (Sandbox Code Playgroud)
在BViewController中,属性bPropery1定义为如下复制(注意,B还包含UITableView和其他属性):
@property (nonatomic, copy) NSString *bProperty1;
Run Code Online (Sandbox Code Playgroud)
在A和B之间来回导航时,一切似乎都能正常工作.直到我在BViewController中包含的表视图中添加了一个UISearchDisplayController.现在,当我离开B,回到A时,应用程序崩溃了.
堆栈跟踪显示在崩溃时自动释放的搜索显示控制器的外观:
#0 0x009663a7 in ___forwarding___
#1 0x009426c2 in __forwarding_prep_0___
#2 0x018c8539 in -[UISearchDisplayController _destroyManagedTableView]
#3 0x018c8ea4 in -[UISearchDisplayController dealloc]
#4 0x00285ce5 in NSPopAutoreleasePool
Run Code Online (Sandbox Code Playgroud)
NSZombies显示:
-[BViewController respondsToSelector:]: message sent to deallocated instance 0x406c1e0 …Run Code Online (Sandbox Code Playgroud) 我正在使用Xamarin.IOS开发我的第一个真正的应用程序.大多数时候,应用程序运行良好,但每天几次崩溃与以下堆栈跟踪:
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:
================================================================= …Run Code Online (Sandbox Code Playgroud)