簡體   English   中英

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時,我開始工作正常。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM