Xamarin VS 2017 无法呈现 iOS 故事板文档

Posted

技术标签:

【中文标题】Xamarin VS 2017 无法呈现 iOS 故事板文档【英文标题】:Xamarin VS 2017 cannot render iOS storyboard document 【发布时间】:2017-08-21 20:28:13 【问题描述】:

我在 Windows 上的 VS 2017 中启动了一个新的 Xamarin 跨平台项目。 android 部分工作正常,但是当我尝试打开 ios Main.Storyboard 文件时,出现错误。我连接到具有 xcode 8.3 的 mac。

Windows VS 上的 Xamarin.iOS 版本 - 10.4.0.123

Mac 上 VS 社区 2017 上的 Xamarin iOS 版本 - 10.12.0.18

除了降级 xcode 之外,我找不到任何答案。我认为这个问题可能与 Xamarion.iOS 版本不匹配有关,但我不知道如何解决这个问题。非常感谢任何帮助!

完整的错误日志:

System.AggregateException: One or more errors occurred. ---> System.InvalidOperationException: The returned remote SDK entries are invalid
   at MonoTouch.Design.Client.IosSdkTarget.InitializeLocalFileStore()
   at MonoTouch.Design.Client.IosSdkTarget..ctor(Version xcodeVersion, DataPackEntry[] datapack, String storeDirectory)
   at MonoTouch.Design.Client.IPhoneDesignerSession.<SetupSession>d__257.MoveNext()
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at MonoTouch.Design.Client.IPhoneDesignerSession.<>c__DisplayClass256_0`1.<EnsureSession>b__0()
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at MonoTouch.Design.Client.IPhoneDesignerSession.<RenderXmlWithPartialReloadRetry>d__175.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at MonoTouch.Design.Client.IPhoneDesignerSession.<RenderXmlWithPartialReloadRetry>d__175.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at MonoTouch.Design.Client.IPhoneDesignerSession.<RenderXml>d__174.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at MonoTouch.Design.Client.IPhoneDesignerSession.<RenderXml>d__174.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at MonoTouch.Design.Client.IPhoneDesignerSession.<ReloadItemsAsync>d__170.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at MonoTouch.Design.Tasks.<Cancellable>d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at MonoTouch.Design.Client.IPhoneDesignerSession.<ReloadItems>d__169.MoveNext()
---> (Inner Exception #0) System.InvalidOperationException: The returned remote SDK entries are invalid
   at MonoTouch.Design.Client.IosSdkTarget.InitializeLocalFileStore()
   at MonoTouch.Design.Client.IosSdkTarget..ctor(Version xcodeVersion, DataPackEntry[] datapack, String storeDirectory)
   at MonoTouch.Design.Client.IPhoneDesignerSession.<SetupSession>d__257.MoveNext()<---


Contents of C:\Users\Jdoyle\AppData\Local\Xamarin\Logs\15.0\iOSDesigner-11168.2017-08-21__16-14-59.log:
MDAddinsHash: 1363a8d943bab7700c93a97474060b6734aa7f94

[2017-08-21 16:17:10.2] INFO: Starting full reload...
[2017-08-21 16:17:10.8] INFO: Reloading: Serialization took 0ms
[2017-08-21 16:17:30.4] INFO: Reloading: Deserialization took 13ms
[2017-08-21 16:17:30.4] INFO: Reloading: Server rendering completed in 19520ms with 52744 bytes
[2017-08-21 16:17:30.4] ERROR: EnsureSession (counter 1): System.AggregateException: One or more errors occurred. ---> System.InvalidOperationException: The returned remote SDK entries are invalid
   at MonoTouch.Design.Client.IosSdkTarget.InitializeLocalFileStore()
   at MonoTouch.Design.Client.IosSdkTarget..ctor(Version xcodeVersion, DataPackEntry[] datapack, String storeDirectory)
   at MonoTouch.Design.Client.IPhoneDesignerSession.<SetupSession>d__257.MoveNext()
   --- End of inner exception stack trace ---
---> (Inner Exception #0) System.InvalidOperationException: The returned remote SDK entries are invalid
   at MonoTouch.Design.Client.IosSdkTarget.InitializeLocalFileStore()
   at MonoTouch.Design.Client.IosSdkTarget..ctor(Version xcodeVersion, DataPackEntry[] datapack, String storeDirectory)
   at MonoTouch.Design.Client.IPhoneDesignerSession.<SetupSession>d__257.MoveNext()<---

编辑解决方案

对于遇到同样问题的任何人,安装 VS 的 Xamarin 更新扩展并更新 Xamarin Apple SDK 为我解决了这个问题。按照步骤here.

【问题讨论】:

【参考方案1】:

更新到最新版本修复它。

此外,在 Windows 上使用 Visual Studio 2017 时,我遇到了同样的问题。 升级 Xamarin(mac 和 windows 上的稳定通道)并将 Visual Studio 2017 更新到最新版本 (15.0.26228.12) 为我修复了它。

见: [https://releases.xamarin.com/technical-bulletin-xcode-8-3-support-for-vs-2017/][1]

【讨论】:

我看不到为 VS 2017 升级 xamarin 的方法。文档只是告诉你更新 Visual Studio(我做了)。developer.xamarin.com/guides/ios/getting_started/installation/…【参考方案2】:

我对此问题的最佳建议是NEVER 使用IOS designer。这是垃圾。始终使用 Xcode Interface Builder。主要原因是,您可以保证情节提要在 IOS 中有效。我曾经在 IOS Designer 中创建了一个空故事板,并将它生成的 XML 与在 Xcode 中创建的空故事板进行了比较。这是完全不同的。设计师版本缺少大量信息。从那以后,我再也不信任 IOS 设计师了。不仅如此,约束在 IOS 设计器上使用起来也很痛苦,因此,它们在 Xcode 中要容易得多。如果布局特别复杂,我也会在 IOS 设计器中渲染完全错误的情节提要。

【讨论】:

以上是关于Xamarin VS 2017 无法呈现 iOS 故事板文档的主要内容,如果未能解决你的问题,请参考以下文章

Xamarin iOS 项目中的自动预配

在VS2017上的Xamarin iOS模拟器在Windows中显示黑屏

在VS 2017专业版中为Windows启用远程模拟器

OxyPlot 无法在 Xamarin Forms UWP 中呈现

使用 Xamarin 将 IOS 应用程序安装到在 VS 中构建的设备时出错

从 Visual Studio 2019 Xamarin.iOS 连接到 Mac 的代理问题