Xamarin.Forms iOS UIKit.UIImage错误 [英] Xamarin.Forms iOS UIKit.UIImage Error

查看:132
本文介绍了Xamarin.Forms iOS UIKit.UIImage错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I've been working with making a mobile app using Xamarin.Forms. I have everything working on android, but when I try to launch on iOS I get the error:

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.
....

有谁知道如何解决这个问题?

Does anyone know how to solve this?

编辑:
下面是它给我的错误代码,但我感觉有其他东西导致它:

Here is the code it gives me the error on, but I have the feeling something else is causing it:

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上它不被支持,所以要解决这个错误,我只需要注释掉设置了标签视图图标的行。

So it turns out the error was being caused by trying to give an icon to a tabbed view. This works fine on android, but apparently on ios it isn't supported, so to fix the error I just had to comment out the line where the an icon for the tabbed view was set.

这篇关于Xamarin.Forms iOS UIKit.UIImage错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆