首页 > 解决方案 > Resolution failed exception in Xamarin IOS prism

问题描述

I have an iOS application written in Xamarin and I am getting a Unity Exceptions Resolution Failed exception when I try and run the application in iOS. However this error does not happen when I run the android version of the application. The exception is being thrown while the initalize function from prism is taking place.

Here is a snippet from my app.xaml.cs

protected override void RegisterTypes(IContainerRegistry containerRegistry)
    {
        this.RegisterLocal(containerRegistry);
        this.RegisterServices(containerRegistry);  
        this.RegisterPagesForNavigation(containerRegistry);
    }

This code all executes and passes.

This is the iOS initialization

Register("AppDelegate")]
public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate
{
    public override bool FinishedLaunching(UIApplication app, NSDictionary options)
    {

        global::Xamarin.Forms.Forms.Init();

        PullToRefreshLayoutRenderer.Init();

        LoadApplication(new App(new IosInitializer()));

        return base.FinishedLaunching(app, options);
    }

    public class IosInitializer : IPlatformInitializer
    {
        public void RegisterTypes(IContainerRegistry containerRegistry)
        {
            containerRegistry.Register<IUAirshipUpdate, UAirshipUpdate>();
        }
    }

This code also executes

The exception being thrown is an argument null exception indicating that IModuleCatelog is not present. I do not understand why it is looking for that module and can not find it. The source code on GitHub indicates that class was registered.

标签: xamarinxamarin.formsunity-containerprism

解决方案


导致此问题的原因是 IOS 应用程序的链接器行为设置为完整,这会导致 Unity IOC 容器出现问题。


推荐阅读