gpt4 book ai didi

c# - 从 IntPtr 创建 NSException

转载 作者:行者123 更新时间:2023-11-28 21:27:28 25 4
gpt4 key购买 nike

我指的是这个post :

private static void MyUncaughtExceptionHandler(IntPtr exception)
{
// this is not working because NSException(IntPtr) is a protected constructor
var e = new NSException(exception);
// ...
}

如何在此处创建异常?

我应该这样做吗?

NSException exception = (NSException)ObjCRuntime.Runtime.GetNSObject(handle);

最佳答案

您自己找到了正确答案:

NSException exception = (NSException) ObjCRuntime.Runtime.GetNSObject (handle);

关于c# - 从 IntPtr 创建 NSException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37525472/

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