Jjohnny
Jjohnny

Reputation: 21

Prism, accessing DryIoC container from AppDelegate

I want to access the IoC Container from the FinishedLoading and the RegisteredForRemoteNotifications/OpenUrl functions in the App Delegate, is this possible?

I tried to access the container after the App was initialised in the Finishedloading function but it throws an error saying it's unable to resolve.

    public override bool FinishedLaunching(UIApplication app, NSDictionary options)
    {
        global::Xamarin.Forms.Forms.Init();

        var iosApp = new App(new iOSInitializer());

        LoadApplication(iosApp);

        var container = iosApp.Container;

        _appModel = container.Resolve<IAppModel>();
        _configuration = container.Resolve<IConfiguration>();
        _notificationService = container.Resolve<INotificationService>();

        return base.FinishedLaunching(app, options);
    }

Upvotes: 0

Views: 359

Answers (1)

Aaron Ramos
Aaron Ramos

Reputation: 97

Adding DryIoc namespace worked for me.

using DryIoc;

Upvotes: 0

Related Questions