【发布时间】:2016-01-07 13:19:44
【问题描述】:
我一直在使用 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");
}
}
}
【问题讨论】:
-
请在您加载/分配图像的位置显示代码。
-
任何未处理的异常都会冒泡到 Main - 但这显然不是错误的根源。我认为它是由一些在 iOS 上损坏或丢失的 Image 元素引起的,但在 Android 上有效。
标签: ios forms xamarin uikit xamarin.forms