1

我很难弄清楚为什么我不能在 Xamarin iOS 应用程序的 ViewController 中进行属性注入。

我的类型已注册,并使用以下代码在我的 ViewController 构造函数中正确解析:

myService = TinyIoCContainer.Current.Resolve<IMyService>();

但我相信我应该能够让 TinyIoC “填充”我的 ViewController 的公共属性,而不是手动分配所有的 deps:

TinyIoCContainer.Current.BuildUp (this);

在我的 ViewController 的构造函数中,但是一旦我尝试运行这行代码,即使没有在我的 ViewController 上指定任何公共属性 - 我也会收到一个 stackoverflow 异常和很多错误。

谁能告诉我我在这里可能做错了什么?

4

0 回答 0