无法使用 Prism 8 找到方法 Shiny.IShinyStartup.ConfigureServices
Can't find method Shiny.IShinyStartup.ConfigureServices with Prism 8
我在应用程序启动期间遇到的错误如下:
Parent class vtable failed to initialize, due to: Could not load list of method overrides due to Method not found: void Shiny.IShinyStartup.ConfigureServices(Microsoft.Extensions.DependencyInjection.IServiceCollection) assembly:/Users/merickson/Library/Developer/CoreSimulator/Devices/D19E269D-A3E5-46C2-BB9C-94A122EA02DC/data/Containers/Bundle/Application/F9A34529-8F64-4868-8D7F-389C77DB54BC/PrismSizeTest.iOS.app/Shiny.Prism.dll type:PrismStartup member:(null)
我不确定我是否遗漏了 NuGet,可能是一个或多个 NuGet 的版本错误,还是我初始化有误?感谢任何帮助。
我已经能够用一个基本的解决方案来复制这个,如果需要我可以提供。以下是涉及的主要文件:
App.xaml.cs
public partial class App : PrismApplicationBase
{
public App(IPlatformInitializer initializer)
: base(initializer)
{
}
protected override async void OnInitialized()
{
InitializeComponent();
await NavigationService.NavigateAsync("NavigationPage/MainPage");
}
protected override void RegisterTypes(IContainerRegistry containerRegistry)
{
containerRegistry.RegisterSingleton<IAppInfo, AppInfoImplementation>();
containerRegistry.RegisterForNavigation<NavigationPage>();
containerRegistry.RegisterForNavigation<MainPage, MainPageViewModel>();
}
protected override IContainerExtension CreateContainerExtension() => ContainerLocator.Current;
}
AppDelegate.cs
[Register("AppDelegate")]
public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate
{
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
ShinyHost.Init(new ApplePlatform(), new MyStartup());
global::Xamarin.Forms.Forms.Init();
LoadApplication(new App(new iOSInitializer()));
return base.FinishedLaunching(app, options);
}
}
public class iOSInitializer : IPlatformInitializer
{
public void RegisterTypes(IContainerRegistry containerRegistry)
{
// Register any platform specific implementations
}
}
MyStartup.cs
public class MyStartup : PrismStartup
{
protected override void ConfigureServices(IServiceCollection services)
{
services.UseGps<GpsDelegate>();
}
}
已安装 NuGets:
代码没有任何直接错误...但是最新版本的 Shiny 具有破坏性 ABI 更改,使 Shiny.Prism 和 Shiny.Core 不兼容,这是此处显示的问题的结果。 ..
有关详细信息,您可以在以下位置跟踪问题:https://github.com/dansiegel/Prism.Container.Extensions/issues/183
我在应用程序启动期间遇到的错误如下:
Parent class vtable failed to initialize, due to: Could not load list of method overrides due to Method not found: void Shiny.IShinyStartup.ConfigureServices(Microsoft.Extensions.DependencyInjection.IServiceCollection) assembly:/Users/merickson/Library/Developer/CoreSimulator/Devices/D19E269D-A3E5-46C2-BB9C-94A122EA02DC/data/Containers/Bundle/Application/F9A34529-8F64-4868-8D7F-389C77DB54BC/PrismSizeTest.iOS.app/Shiny.Prism.dll type:PrismStartup member:(null)
我不确定我是否遗漏了 NuGet,可能是一个或多个 NuGet 的版本错误,还是我初始化有误?感谢任何帮助。
我已经能够用一个基本的解决方案来复制这个,如果需要我可以提供。以下是涉及的主要文件:
App.xaml.cs
public partial class App : PrismApplicationBase
{
public App(IPlatformInitializer initializer)
: base(initializer)
{
}
protected override async void OnInitialized()
{
InitializeComponent();
await NavigationService.NavigateAsync("NavigationPage/MainPage");
}
protected override void RegisterTypes(IContainerRegistry containerRegistry)
{
containerRegistry.RegisterSingleton<IAppInfo, AppInfoImplementation>();
containerRegistry.RegisterForNavigation<NavigationPage>();
containerRegistry.RegisterForNavigation<MainPage, MainPageViewModel>();
}
protected override IContainerExtension CreateContainerExtension() => ContainerLocator.Current;
}
AppDelegate.cs
[Register("AppDelegate")]
public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate
{
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
ShinyHost.Init(new ApplePlatform(), new MyStartup());
global::Xamarin.Forms.Forms.Init();
LoadApplication(new App(new iOSInitializer()));
return base.FinishedLaunching(app, options);
}
}
public class iOSInitializer : IPlatformInitializer
{
public void RegisterTypes(IContainerRegistry containerRegistry)
{
// Register any platform specific implementations
}
}
MyStartup.cs
public class MyStartup : PrismStartup
{
protected override void ConfigureServices(IServiceCollection services)
{
services.UseGps<GpsDelegate>();
}
}
已安装 NuGets:
代码没有任何直接错误...但是最新版本的 Shiny 具有破坏性 ABI 更改,使 Shiny.Prism 和 Shiny.Core 不兼容,这是此处显示的问题的结果。 ..
有关详细信息,您可以在以下位置跟踪问题:https://github.com/dansiegel/Prism.Container.Extensions/issues/183