我有一个xamarin表单应用程序。当我在我的Pixel3上编译和测试时,一切似乎都正常工作。当我将它加载到运行iOS13.thing的iOS设备上时,当我试图在我的应用程序中第二次调用web服务时,我得到了以下错误。错误如下所示。
在aot-only模式下运行时,/Users/builder/jenkins/workspace/archive-mono/2019-08/ios/release/mono/mini/interp/interp.c:2160,条件`is_ok (错误)处的断言“未满足,function:do_jit_call,正在尝试即时编译方法”(包装其他)使object:gsharedvt_out_sig (object&,single&,int&,intptr)无效。有关详细信息,请参阅https://docs.microsoft.com/xamarin/ios/internals/limitations。程序集:类型:成员:(Null)
代码有点乱七八糟,但在过去是可以工作的。
var uri = String.Format("{0}//{1}/{2}?PlayerToken={3}", protocol, servername, tournamentsInClubUrl, userToken);
var httpC = new HttpClient();
HttpRequestMessage requestMessage = new HttpRequestMessage(HttpMethod.Get, uri);
requestMessage.Headers.Add("AppKey", AppKey);
var body = await httpC.SendAsync(requestMessage); <-- Error happens here.
var str = await body.Content.ReadAsStringAsync();
var res = JsonConvert.DeserializeObject<List<PicVideoApp.Models.TournamentInfo>>(str);
httpC.Dispose();
httpC = null;
return res;我假设我做错了什么,但如果我能看到的话我会很生气。任何想法都是值得感谢的。
它可以在iOS模拟器中正常运行。
蒂娅。
发布于 2020-02-25 10:47:59
从共享的错误信息中,您需要对call native functions使用C#委托。
若要通过C#委托调用本机函数,必须使用以下属性之一修饰该委托的声明:
兼容
例如:
[MonoNativeFunctionWrapper]
delegate void SomeDelegate (int a, int b);
//
// the ptrToFunc points to an unmanaged C function with the signature (int a, int b)
void Callback (IntPtr ptrToFunc)
{
var del = (SomeDelegate) Marshal.GetDelegateForFunctionPointer (ptrToFunc, typeof (SomeDelegate));
// invoke it
del (1, 2);发布于 2021-11-24 18:57:26
当我在代码中使用动态类型时,在iOS中抛出了一个类似的错误。我能够通过在iOS构建设置中启用'Mono解释器‘来解决这个问题。希望这对你的情况有所帮助。

https://stackoverflow.com/questions/60385610
复制相似问题