Error MT2002 in xamarin studio (Monotouch)

2019-07-02 05:43发布

问题:

Good day ,

I'm using Xamarin Studio 4.0.12 (build 3) for my iOS app , but I unable to build app to device or iOS simulator due to an error :

Error MT2002: Failed to resolve "System.Void MonoTouch.Foundation.FieldAttribute::.ctor(System.String,System.String)" reference from "monotouch, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065

When I change ' Linker Behaviour ' to ' Link SDK assembly only ' that error occur , but if I change to ' Don't Link ' every thing work great , but app size will change from 23mb to 60mb .

Thx

回答1:

The [Field] attribute was added in 6.2.6 (see API diff from release notes).

This means you're using an assembly binary (e.g. bindings) that was compiled with 6.2.6+ and it not compatible with earlier versions of Xamarin.iOS.

You can either try to get an older version of that assembly or update to 6.2.6 (or a more recent version) of Xamarin.iOS.