Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/121.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 调用方法_getImplementation会在设备上引发ExecutionEngineeException_C#_Ios_Xamarin.ios_Xamarin - Fatal编程技术网

C# 调用方法_getImplementation会在设备上引发ExecutionEngineeException

C# 调用方法_getImplementation会在设备上引发ExecutionEngineeException,c#,ios,xamarin.ios,xamarin,C#,Ios,Xamarin.ios,Xamarin,我正在尝试从问题的答案开始执行swizzling。我有一个例子。完全崩溃是不可能的 抛出一个ExecutionEngineeException 正在尝试JIT编译方法(包装器管理为本机) System.Func`3:wrapper\u aot\u native (intptr&,intptr,intptr)“”而仅使用--aot运行 我需要做什么才能编译AOT?或者,这是在ARM64上调用方法_getImplementation(方法)的问题吗?我找到了一些关于这个的信息 似乎在arm64上使用

我正在尝试从问题的答案开始执行swizzling。我有一个例子。完全崩溃是不可能的

抛出一个
ExecutionEngineeException

正在尝试JIT编译方法(包装器管理为本机) System.Func`3:wrapper\u aot\u native (intptr&,intptr,intptr)“”而仅使用--aot运行

我需要做什么才能编译AOT?或者,这是在ARM64上调用方法_getImplementation(方法)的问题吗?我找到了一些关于这个的信息

似乎在arm64上使用imp_实现时发生了块崩溃

还有更多:

注意objc_msgSend的铸件。而这(幸运的)没有起作用 在早期的版本中,这可能会使您的arm64版本崩溃 如果您没有正确地强制转换它,因为变量参数 铸件规格改变了


objective-c中有一个例子,其中检查了体系结构,32对64的行为有所不同。我想知道我是否有同样的问题。

返回值是“IntPtr”,而不是“Func”

它曾经是一个函数吗?
[DllImport("/usr/lib/libobjc.dylib")]
extern static Func<IntPtr,IntPtr,IntPtr> method_getImplementation(IntPtr method);

delegate void CaptureDelegate(IntPtr block,IntPtr self,IntPtr uiView);

[MonoPInvokeCallback(typeof(CaptureDelegate))]
static void MyCapture(IntPtr block, IntPtr self, IntPtr uiView)
{
}

static void HijackWillMoveToSuperView()
{
    var method = class_getInstanceMethod(new UIView().ClassHandle, new Selector("willMoveToSuperview:").Handle);

    original_impl = method_getImplementation(method);

    var block_value = new BlockLiteral();
    CaptureDelegate d = MyCapture;
    block_value.SetupBlock(d, null);
    var imp = imp_implementationWithBlock(ref block_value);
    method_setImplementation(method, imp);
}
 original_impl = method_getImplementation(method);