gpt4 book ai didi

exception - 我可以选择哪些选项来寻找 Monotouch 异常(例如 "System.Exception: Selector invoked from objective-c on a managed object that has been GC' ed”)?

转载 作者:行者123 更新时间:2023-12-02 22:56:06 25 4
gpt4 key购买 nike

我在下面得到了一些异常(exception)情况。我有什么选择来追踪这些问题?我对这些感到有点迷失,因为它们只是偶尔发生,并且仅在设备上发生,但从未在模拟器中发生。

System.Exception: Selector invoked from objective-c on a managed object that has been GC'ed ---> System.MissingMethodException: No constructor found for Browser.FolderListController::.ctor(System.IntPtr)
at System.Activator.CreateInstance (System.Type type, BindingFlags bindingAttr, System.Reflection.Binder binder, System.Object[] args, System.Globalization.CultureInfo culture, System.Object[] activationAttributes) [0x00000] in <filename unknown>:0
at System.Activator.CreateInstance (System.Type type, System.Object[] args, System.Object[] activationAttributes) [0x00000] in <filename unknown>:0
at System.Activator.CreateInstance (System.Type type, System.Object[] args) [0x00000] in <filename unknown>:0
at MonoTouch.ObjCRuntime.Runtime.ConstructNSObject (IntPtr ptr, IntPtr klass) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at MonoTouch.ObjCRuntime.Runtime.ConstructNSObject (IntPtr ptr, IntPtr klass) [0x00000] in <filename unknown>:0
at MonoTouch.ObjCRuntime.Runtime.GetNSObject (IntPtr ptr) [0x00000] in <filename unknown>:0
at MonoTouch.ObjCRuntime.Runtime.GetNSObjectWrapped (IntPtr ptr) [0x00000] in <filename unknown>:0
at (wrapper native-to-managed) MonoTouch.ObjCRuntime.Runtime:GetNSObjectWrapped (intptr)
at MonoTouch.UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00000] in <filename unknown>:0
at Browser.Application.Main (System.String[] args) [0x00000] in .../Main.cs:15

最佳答案

这与OP的情况并不完全相关,但我在从 Nib 加载 View 时遇到了这个错误,结果发现我没有正确设置 View 类的构造函数:

public MyView() : base()
{
// Wrong!
}

您需要包含 IntPtr 参数:

public MyView(IntPtr handle) : base(handle)
{

}

关于exception - 我可以选择哪些选项来寻找 Monotouch 异常(例如 "System.Exception: Selector invoked from objective-c on a managed object that has been GC' ed”)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8344613/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com