c# - 从 IntPtr 创建 NSException

标签 c# ios xamarin.ios nsexception

我指的是这个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/

相关文章:

ios - 在 iOS 8 中以编程方式安装配置文件

ios - MonoTouch 中的 AesCryptoServiceProvider

ios - iBeacon 错误或错误?

c# - 使用 C# 驱动程序将新字段插入 MongoDB 中的现有集合(许多文档)

c# - 使用带有 Vb.net 或 C# 的新 Bing 市场翻译器

c# - 关于自定义事件的问题

ios - 核心数据查询值 "is not nil"未返回值等于 0 的对象

objective-c - UITableViewCell 中的 UIGestureRecognizer

iphone - 通过 tableview 添加 View (UITableViewController)

c# - Visual Studio 2015 Community Edition 下载新许可证失败