Reputation: 21
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