简体   繁体   English

iOS上的Xamarin Forms,而调试元素变为null

[英]Xamarin Forms on iOS, while debugging elements turns to null

I have a Xamarin Forms App, it works fine, but on click events it doesn't work, I tried to debug and noticed that my gui objects are all turned to null, I don't even know why, I tried to compare it with null and re-initialize then, but this if-statement just was ignored by mono! 我有一个Xamarin Forms App,它可以正常工作,但是在单击事件上它不起作用,我尝试调试并注意到我的gui对象都变成了null,我什至不知道为什么,我尝试对其进行比较用null然后重新初始化,但是单声道忽略了这个if语句! What the heck? 有没有搞错?

here is my class: http://pastebin.com/jDufJ9sb 这是我的课: http : //pastebin.com/jDufJ9sb

ActivityIndicator turn to null I don't know when, but when I check it on 224 line, and Debugger shows that it is null, but if-statement doesn't run properly ActivityIndi​​cator变成null我不知道什么时候,但是当我在224行检查它时,Debugger显示它为null,但是if语句无法正常运行

You're using async method for views initialization: 您正在使用异步方法进行视图初始化:

private async Task Load(Profile profile)

There're places where you call that function (eg. line 70): 在某些地方可以调用该函数(例如,第70行):

  • without await (so fire and forget) 无需等待
  • without using Device.BeginInvokeOnMainThread. 而不使用Device.BeginInvokeOnMainThread。 Remember: All operations on UI must be done from UI thread. 切记: 对UI的所有操作必须从UI线程完成。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM