简体   繁体   中英

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! What the heck?

here is my class: 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

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):

  • without await (so fire and forget)
  • without using Device.BeginInvokeOnMainThread. Remember: All operations on UI must be done from UI thread.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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