我一直在使用 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");
}
}
}
最佳答案
所以事实证明,错误是由于试图为选项卡式 View 提供图标而引起的。这在 android 上运行良好,但显然在 ios 上不受支持,所以要修复错误,我只需要注释掉设置选项卡式 View 的图标的行。
关于ios - Xamarin.Forms iOS UIKit.UIImage 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33619308/