I have following project:
MyForm unit(just empty form):
unit uMyForm;
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs;
type
TMyForm = class(TForm)
end;
implementation
{$R *.fmx}
end.
App Unit:
unit App;
interface
uses
uMyForm,
Spring.Container;
type
TApp = class
private
_myForm: TMyForm;
public
[Inject]
constructor Create(myForm: TMyForm);
end;
implementation
uses
System.SysUtils;
{ TApp }
constructor TApp.Create(myForm: TMyForm);
begin
_myForm := myForm;
end;
end.
And build code:
procedure BuildProject;
begin
GlobalContainer.RegisterType<TApp>;
GlobalContainer.RegisterType<TMyForm>;
GlobalContainer.Build;
_app := GlobalContainer.Resolve<TApp>;
end;
Run BuildProject() causes Error: “Cannot resolve type: TMyForm”. I was testing same configuration on VCL platform and there everything is ok. Do you have any idea what is wrong here?
Edit1: I had to change problem description because I was wrong thinking that the problem occurs on both(VCL and FMX) platforms. @RudyVelthuis ‘s comment showed me that problem is only on FMX platform.