1

In my view.designer.cs my outlets are generated by xcode.

When starting debug I have a null reference exception on my properties when adding bindings, in the code bellow this.SampleText is null.

public override void ViewDidLoad ()
        {
            base.ViewDidLoad ();

            this.AddBindings(
                new Dictionary<object, string>()
                {
                    { this.SampleText, "{'Text':{'Path':'VMText'}}"}
                });     
        }

I noticed the following error in Application's output : "Application windows are expected to have a root view controller at the end of application launch"

what did I miss ?

Stuart
  • 66,722
  • 7
  • 114
  • 165
Paul Angevelle
  • 257
  • 1
  • 3
  • 13

2 Answers2

0

It sounds like you might have a more general problem with your iOS setup - possibly some issues with the XIB file synchronisation between xcode and MonoTouch.

Before you try to add the MvvmCross binding take a look at the MonoTouch layer - if this.SampleText is null in the MonoTouch layer then you need to solve that before you can add the MvvmCross binding code.

The MonoTouch soft debugger is an excellent tool to help debug this - and the debug cycle with the simulator is pretty quick - so this often helps solve these problems.


From your partial answer to this question, it does sounds like you were trying to use a XIB in a Dialog based UI - that's probably not going to work - I think MonoTouch.Dialog is always based on a single Table - so it's not expecting a XIB (at least, that's my experience!)


As for "Application windows are expected to have a root view controller at the end of application launch" that sounds more like a general problem in your AppDelegate.cs perhaps. Alternatively it might be a problem in the presenter. Which presenter are you using?

That error message itself has a lot of hits on StackOverflow - e.g. Applications are expected to have a root view controller at the end of application launch - but I'm not sure which of these is appropriate to your case right now.


I must admit everything is not clear for me with iOS and MVVMCross

For coders coming from a C# background I don't think this is unusual - I think the jump from VS on Windows to MonoDevelop on Mac (with a little xcode) is a non-trivial leap. It takes more time to switch from WP to iOS development than it does from WP to Droid - this is the case independent of whether you use MvvmCross - if you are doing MT development you are doing native code, so you do have to take some time to understand iOS a bit (in my experience/opinion!).

For the most part, I've personally written tens of thousands of lines of code, authored hundreds of blog posts and stackoverflow answers, and presented maybe ten sessions on mvvmcross. I've done this across five distinct operating systems, four of which I've learnt as I've coded and all of which I've battled against platform and tooling bugs and idiosyncrasies.

I'll continue to post as much as I can - and continue to operate for 'free'

I do also encourage every user to post and blog about their experience too. In this way I hope knowledge will be generated and shared. To anyone who is reading this, using mvvmcross and learning something about cross platform coding - good or bad - then please do consider sharing that knowledge. For inspiration, check out some of the presentations and blog posts users have written - I try to list them on http://slodge.blogspot.co.uk/p/mvvmcross-quicklist.html. Thanks :)


Also, when asking questions, please can you indicate which version of mvvmcross you are using and which sample(s) you're basing your code on - there are differences between master and vNext and there have been fixes over time - so posting this info will help me try to understand and/or replicate the errors you are seeing.

Thanks :)

Community
  • 1
  • 1
Stuart
  • 66,722
  • 7
  • 114
  • 165
  • I really find your support incredible ! I'm really confused with the different MvxXXXXViewControler, I tried to copy/paste your samples code, but I think I should dive in your code as for Android ;-) Concerning bloging, I've planned to write articles for "dummies", with detailed step by step coding. As I'm still a dummy with OSX/iOS, and was also one with Monodroid and WP7 a month ago, I think I'm fully qualified for this ;-) I hope this can help monotouch/droid and MVVMCross adoption. – Paul Angevelle Dec 09 '12 at 11:35
  • Thanks - my comments on sharing knowledge were general and aimed at everyone , not you. every contribution is really appreciated - the world keeps on changing and we're all always learning :) but i also encourage people to find balance - don't spend too long on the laptop - save lots of quality time for the kids, wife, family, friends, dog, etc :) thanks :) – Stuart Dec 09 '12 at 14:11
  • PS I also do really value the questions - i think they help locate, generate and share knowledge too - please don't stop asking :) – Stuart Dec 09 '12 at 14:17
  • I modified my original MvxTouchDialogViewController base class and changed it to MvxBindingTouchViewController I must admit everything is not clear for me with iOS and MVVMCross (it's OK for android and WP) App know launches, but command bindings don't work ... I'm still investigating this issue – Paul Angevelle Dec 08 '12 at 18:02
  • I found the pb with my command bindings ... 'Click' doesn't seem to exist in mono touch. I had to use { this.Btn, "{'TouchUpInside':{'Path':'ClickBtnCommand'}}"} to get event fired on click (this.Btn is a UIButton). – Paul Angevelle Dec 10 '12 at 17:10
0

I know this is a little old, but I was just having the same issue.

My outlet properties in my View.designer.cs file were null when I attempted to access them when ViewDidLoad was called.

Turned out that my xib file in Visual Studio was no longer set to a Build Action of InterfaceDefinition.

Hopefully, this helps someone else who stumbles upon this issue.