【问题标题】:Splat [0.3.4] on Xamarin.iOS: issues with RectangleF and PointFXamarin.iOS 上的 Splat [0.3.4]:RectangleF 和 PointF 问题
【发布时间】:2026-01-19 00:25:11
【问题描述】:

我正在尝试在 Xamarin Studio 中的 Xamarin.iOS 项目中接受新的 PCL 乐趣。我为我的项目创建了一个 PCL“核心”库,并通过 NuGet 添加了Splat (v0.3.4)。然后,在一个使用中的 iOS 项目中,我引用了我的核心库。一旦我这样做了,就会出现几个编译错误。

其中之一:

Error CS0012: The type `System.Drawing.PointF' is defined in an assembly that is not referenced. Consider adding a reference to assembly `Splat.Portable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' (CS0012)

多个:

Error CS0029: Cannot implicitly convert type `System.Drawing.PointF [monotouch, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065]' to `System.Drawing.PointF [Splat.Portable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]' (CS0029)

看起来这个问题已经在自 v0.3.4 命中 NuGet 后登陆的 pull request to Splat 中得到解决。按照那里的注释,我在 iOS 项目中添加了对 Splat.Portable.dll 的引用。当我这样做时,编译错误会变成抱怨类型定义太多。

Error CS0433: The imported type `System.Drawing.RectangleF' is defined multiple times (CS0433)
Error CS0433: The imported type `System.Drawing.PointF' is defined multiple times (CS0433)

是否可以使用 Xamarin Studio 4.2.1 (Xamarin.iOS 7.0.4.209) 和 Splat 0.3.4 来解决这些错误,还是我需要构建具有出色类型转发功能的最新代码?

【问题讨论】:

    标签: ios xamarin.ios portable-class-library xamarin-studio


    【解决方案1】:

    是的,我明天会构建一个新版本的 Splat,但是从源代码构建也可以解决这个问题。

    编辑: Splat 1.0 已上线并包含此错误的修复

    【讨论】:

    • 嗨,Paul,我今天刚刚安装了 Splat(实际上它是与 Akavache 一起安装的),我遇到了这个错误。 Splat 版本是 iOS 上的 1.3.3。你知道有什么解决办法吗?谢谢
    【解决方案2】:

    将 Splat 更新到最新版本 (1.6.2) - Splat 1.3.3 仍然存在此问题。

    【讨论】: