微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

在 iOS 和 ArcGIS Runtime 上使用热重启 Xamarin Forms 的应用程序崩溃

如何解决在 iOS 和 ArcGIS Runtime 上使用热重启 Xamarin Forms 的应用程序崩溃

想检查是否有人使用 Visual Studio 热重启在 iOS 上成功使用 ArcGIS Runtime Xamarin Forms?

我在 Visual Studio 中为 iOS 创建了一个新的 Xamarin Forms 应用,并在 AppDelegate.cs 中添加了以下代码

public override bool FinishedLaunching(UIApplication app,NSDictionary options)
{
  global::Xamarin.Forms.Forms.Init();
  LoadApplication(new App());
  Esri.ArcGISRuntime.ArcGISRuntimeEnvironment.Initialize();

  return base.FinishedLaunching(app,options);
}

该应用程序在我的 iPhone 上没有 Initialize 方法的情况下启动并运行良好。感觉就像我缺少一个依赖项。

这是我用 Initialize 方法得到的错误

[0:] An error occurred: 'CoreRT_ArcGISRuntimeEnvironment_setInstallDirectory assembly:<unkNown assembly> type:<unkNown type> member:(null)'. Callstack: '  at (wrapper managed-to-native) RuntimeCoreNet.GeneratedWrappers.CoreArcGISRuntimeEnvironment.CoreRT_ArcGISRuntimeEnvironment_setInstallDirectory(byte[],intptr&)
  at RuntimeCoreNet.GeneratedWrappers.CoreArcGISRuntimeEnvironment.SetInstallDirectory (System.String installPath) <0x138775060 + 0x00010> in <2a33546a5b934b588629d4e33895c554>:0 
  at Esri.ArcGISRuntime.ArcGISRuntimeEnvironment.InitNative () <0x1387748c8 + 0x00004> in <2a33546a5b934b588629d4e33895c554>:0 
  at Esri.ArcGISRuntime.ArcGISRuntimeEnvironment.Initialize () <0x138774538 + 0x00042> in <2a33546a5b934b588629d4e33895c554>:0 
  at App1.iOS.AppDelegate.FinishedLaunching (UIKit.UIApplication app,Foundation.NSDictionary options) [0x00013] in C:\Users\Chris\Documents\OnScene Xplorer\App1\App1.iOS\AppDelegate.cs:33 
  at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr)
  at UIKit.UIApplication.Main (System.String[] args,system.intPtr principal,system.intPtr delegate) [0x00005] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:86 
  at UIKit.UIApplication.Main (System.String[] args,System.String principalClassName,System.String delegateClassName) [0x0000e] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:65 
  at App1.iOS.Application.Main (System.String[] args) [0x00001] in C:\Users\Chris\Documents\OnScene Xplorer\App1\App1.iOS\Main.cs:17 
  at (wrapper managed-to-native) System.Reflection.RuntimeMethodInfo.InternalInvoke(System.Reflection.RuntimeMethodInfo,object,object[],System.Exception&)
  at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj,System.Reflection.BindingFlags invokeAttr,System.Reflection.Binder binder,System.Object[] parameters,System.Globalization.CultureInfo culture) [0x0006a] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/corlib/System.Reflection/RuntimeMethodInfo.cs:395 '

看起来它试图使用每个反射器的 DllImport 调用本地方法

[DllImport("__Internal")]
private static extern void CoreRT_ArcGISRuntimeEnvironment_setInstallDirectory([In,Out,MarshalAs(UnmanagedType.LPArray)] byte[] installPath,out IntPtr outErrorHandle);

我还尝试了 ArcGIS 的示例应用程序,但在启用热重启后,它也会以同样的方式失败。

更多信息...

抛出的异常是 EntryPointNotFoundException 这意味着无法解析本机调用

我在我的 iPhone 上做了一些调查,发现 runtimecore.dll 和 runtimecorenet.dll 没有被复制到部署文件夹。它们在构建期间也不会出现在 bin/Debug 文件夹中。我相信这 2 个 dll 是 Esri.ArcGISRuntime.dll 中本机调用的目标。

所以我想我必须弄清楚如何说服 Visual Studio 将它们包含在 iOS 版本中。我确实看到它们包含在我的 UWP 构建中。

关于如何解决这个问题有什么想法吗?

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。