user472292
user472292

Reputation: 329

Cannot convert `object' expression to type `MonoTouch.Foundation.NSObject'

I started a new MonoTouch project. I opened the Interface Builder and created a button and outlet. I hooked up the button to the outlet. I saved the XIB then went back to MonoDevelop and attempted to build the project. I am getting errors in the generated XIB Designer file. The errors are:

Error CS1502: The best overloaded method match for `MonoTouch.Foundation.NSObject.SetNativeField(string, MonoTouch.Foundation.NSObject)' has some invalid arguments (CS1502) (Test2)
Error CS1503: Argument `#2' cannot convert `object' expression to type `MonoTouch.Foundation.NSObject' (CS1503) (Test2)

This is the property is created:

#pragma warning disable 0169
    [MonoTouch.Foundation.Connect("window")]
    private object window {
        get {
            this.__mt_window = ((object)(this.GetNativeField("window")));
            return this.__mt_window;
        }
        set {
            this.__mt_window = value;
            this.SetNativeField("window", value);
        }
    }

Any ideas?

Upvotes: 2

Views: 900

Answers (1)

Dan Abramov
Dan Abramov

Reputation: 268255

Make sure you're using the most recent (and matching) versions of the tools.
For example, MonoTouch installation page lists the following requirements for the most recent version:

Upvotes: 1

Related Questions