Xamarin.Forms iOS UIKit.UIImage 错误

Xamarin.Forms iOS UIKit.UIImage Error

我一直在使用 Xamarin.Forms 制作移动应用程序。我在 android 上一切正常,但是当我尝试在 iOS 上启动时,出现错误:

System.Exception: Could not initialize an instance of the type 'UIKit.UIImage': the native 'initWithContentsOfFile:' method returned nil.
>It is possible to ignore this condition by setting MonoTouch.ObjCRuntime.Class.ThrowOnInitFailure to false.
....

有人知道怎么解决吗?

编辑: 这是它给我错误的代码,但我觉得是其他原因造成的:

using System;
using System.Collections.Generic;
using System.Linq;

using Foundation;
using UIKit;

namespace CloudClubv1._2_.iOS
{
    public class Application
    {
        // This is the main entry point of the application.
        static void Main(string[] args)
        {
            // if you want to use a different Application Delegate class from "AppDelegate"
            // you can specify it here.
            UIApplication.Main(args, null, "AppDelegate");
        }
    }
}

所以事实证明,错误是由于试图为选项卡式视图提供图标引起的。这在 android 上工作正常,但显然在 ios 上它不受支持,因此为了修复错误,我只需要注释掉设置选项卡式视图图标的行。

确保在 IOS 项目上,将 Resources/image 属性设置为 BundledResources。在我的项目中,它们被设置为 AndroidResources,当我更正为 BundledResources 时,我开始工作正常。