PDF for offline use

Let us know how you feel about this

Translation Quality


last updated: 0201-05

Xamarin.iOS cannot resolve System.ValueTuple

This error occurs due to an incompatibility with Visual Studio.

  • Visual Studio 2017 Update 1 (version 15.1 or older) is only compatible with System.ValueTuple NuGet 4.3.0 (or older).

  • Visual Studio 2017 Update 2 (version 15.2 or newer) is only compatible with the System.ValueTuple NuGet 4.3.1 or newer .

Please choose the correct System.ValueTuple NuGet that corresponds with your Visual Studio 2017 installation.

Receiving 'Error Retrieving Update Information' Error Message

When attempting to update the software and this error message appears, please try restarting your IDE and logging out and then back in to your account in the IDE.

How do I create outlets or actions with Interface Builder?

With the Introduction of the Xamarin Designer for iOS in Visual Studio for Mac and Visual studio, Xamarin.iOS developers can now take advantage of creating a UI through Storyboards and .xibs. Refer to the Hello, iOS guides for more information on using the designer.

You can also refer to Apple's Outlet and Actions guides for more information on using Outlets and Actions in IB.

System.Text.Encoding.GetEncoding throws NotSupportedException

You may be using an encoding that is not added by default. Check the Internationalization page to learn how to add support for more encoding.

System.MissingMethodException (anything else)

The member was likely removed by the linker, and thus doesn't exist in the assembly at runtime. There are several solutions to this:

  • Add the [Preserve] attribute to the member. This will prevent the linker from removing it.
  • When invoking mtouch , use the -nolink or -linksdkonly options. - -nolink disables all linking.
  • -linksdkonly will only link Xamarin.iOS-provided assemblies, such as monotouch.dll or xamarin.ios.dll .

Note that assemblies are linked so that the resulting executable is smaller; thus, disabling linking may result in a larger executable than is desirable.

You are getting a ModelNotImplementedException

If you are getting this exception this means that you are calling base.Method () on a class that overrides a Model. You do not need to call the base method in a class for models (these are classes that are flagged with the [Model] attribute).

This class is not key value coding-compliant for the key XXXX

If you get this error when loading a NIB file it means that the value XXXX was not found on your managed class. This means that you are missing a declaration like this:

TypeName XXXX {
   get {
       return (TypeName) GetNativeField ("XXXX");
   set {
       SetNativeField ("XXXX", value);

The above definition is automatically generated by Visual Studio for Mac for any XIB files that you add to Visual Studio for Mac in the NAME_OF_YOUR_XIB_FILE.designer.xib.cs file.

Additionally, the types containing the above code must be a subclass of NSObject. If the containing type is within a namespace, it should also have a [Register] attribute which provides a type name without a namespace (as Interface Builder doesn't support namespaces in types):

namespace Samples.GLPaint {

    // The [Register] attribute overrides the type name registered
    // with the Objective-C runtime, in this case removing the namespace.
    [Register ("AppDelegate")]
    public class AppDelegate {/* ... */}

Unknown class XXXX in Interface Builder file

This error is generated if you define a class in your interface builder files but you do not provide the actual implementation for it in your C# code.

You need to add some code like this:

public partial class MyImageView : UIView {
   public MyImageView (IntPtr handle) : base (handle {}

System.MissingMethodException: No constructor found for Foo.Bar::ctor(System.IntPtr)

This error is produced at runtime when the code tries to instantiate an instance of the classes that you referenced from your Interface Builder file. This means that you forgot to add a constructor that takes a single IntPtr as a parameter.

The constructor with an IntPtr handle is used to bind managed objects with their unmanaged representations.

To fix this, add the following line of code to the class Foo.Bar:

public Bar (IntPtr handle) : base (handle) { }

Type {Foo} does not contain a definition for GetNativeField' and no extension methodGetNativeField' of type {Foo} could be found

If you get this error in the designer generated files (*.xib.designer.cs), it means one of two things:

1) Missing partial class or base class

The designer-generated partial classes must have corresponding partial classes in user code that inherit from some subclass of NSObject, often UIViewController. Ensure that you have such a class for the type that is giving the error.

2) Default namespaces changed

The designer files are generated using your project's default namespace settings. If you have changed these settings, or renamed the project, the generated partial classes may no longer be in the same namespace as their user-code counterparts.

Namespace settings can be found in the Project Options dialog. The default namespace is found in the General->Main Settings section. If it is blank, the name of your project is used as the default. More advanced namespace settings can be found in the Source Code->.NET Naming Policies section.

Warning for actions: The private method 'Foo' is never used. (CS0169)

Actions for interface builder files are connected to the widgets by reflection at runtime, so this warning is expected.

You can use "#pragma warning disable 0169" "#pragma warning enable 0169" around your actions if you want to suppress this warning just for these methods, or add 0169 to the "Ignore warnings" field in compiler options if you want to disable it for your whole project (not recommended).

mtouch failed with the following message: Cannot open assembly '/path/to/yourproject.exe'

If you see this error message, generally the problem is the absolute path to your project contains a space. This will be fixed in a future version of Xamarin.iOS, but you can work around the issue by moving the project to a folder without spaces.

Your sqlite3 version is old - please upgrade to at least v3.5.0!

This happens when you do all of the following:

  1. Use Mono.Data.Sqlite
  2. Use Mac OS X Leopard (10.5)
  3. Run your app within the simulator.

The problem is that Mono is picking up the OS X libsqlite3.dylib, not the iPhoneSimulator's libsqlite3.dylib file. Your app will work on the device, but just not your simulator.

The short term fix is to use Mac OS X Snow Leopard (10.6).A fix for Leopard (10.5) will be released with a future Xamarin.iOS version.

Deploy to device fails with System.Exception: AMDeviceInstallApplication returned 3892346901

This error means that the code-signing configuration for your certificate/bundle id does not match the provisioning profile installed on your device. Confirm you have the appropriate certificate selected in Project Options->iPhone Bundle Signing, and the correct bundle id specified in Project Options->iPhone Application

Code Completion is not working in Visual Studio for Mac

Ensure that you are using the latest version of Visual Studio for Mac and Xamarin.iOS

If the issue is still present, please file a bug, attaching the ~/Library/Logs/XamarinStudio-{VERSION}/Ide-{TIMESTAMP}.log, AndroidTools-{TIMESTAMP}.log, and Components-{TIMESTAMP}.log log files.

If all else fails, you can try removing the code completion cache so that it is regenerated:

[rm -r ~/.config/XamarinStudio-{VERSION}/CodeCompletionData]

Be careful that you type this command correctly or you could accidentally remove important files.

Visual Studio for Mac crashes when you copy text

The popular Mac utilities QuickSilver, Google Toolbar and LaunchBar have clipboard features that corrupt Visual Studio for Mac's memory. In their options, you can list Visual Studio for Mac as a process they should not interfere with.

Visual Studio for Mac complains about Mono 2.4 required

If you updated Visual Studio for Mac due to a recent update, and when you try to start it again it complains about Mono 2.4 not being present, all you have to do is upgrade your Mono 2.4 installation.

Mono fixes some important problems that prevented Visual Studio for Mac from running reliably, sometimes hung Visual Studio for Mac at startup or prevented the code completion database from being generated.

Once you install the new Mono, Visual Studio for Mac will start as expected.

Assertion at ../../../../mono/metadata/generic-sharing.c:704, condition `oti' not met

If you are receiving the following stack trace:

- Assertion at ../../../../mono/metadata/generic-sharing.c:704, condition `oti' not met
    at System.Collections.Generic.List`1<object>..cctor () <0xffffffff>
    at System.Collections.Generic.List`1<object>..cctor () <0x0001c>
    at (wrapper runtime-invoke) object.runtime_invoke_dynamic (intptr,intptr,intptr,intptr) <0xffffffff>`

It means that you are linking a static library compiled with thumb code into your project. As of iPhone SDK release 3.1 (or higher at the time of this writing) Apple introduced a bug in their linker when linking non-Thumb code (Xamarin.iOS) with Thumb code (your static library).You will need to link with a non-Thumb version of your static library to mitigate this issue.

System.ExecutionEngineException: Attempting to JIT compile method (wrapper managed-to-managed) Foo[]:System.Collections.Generic.ICollection`1.get_Count ()

The [] suffix indicates that you or the class library are calling a method on an array through a generic collection, such as IEnumerable<>, ICollection<> or IList<>. As a workaround, you can explicitely force the AOT compiler to include such method by calling the method yourself, and by making sure that this code is executed before the call that triggered the exception. In this case, you could write:

Foo [] array = null;
int count = ((ICollection<Foo>) array).Count;

Which will force the AOT compiler to include the get_Count method.

Visual Studio for Mac source editor is extremely slow

Sometimes the Visual Studio for Mac source editor becomes extremely slow, appearing to hang for several seconds between typing characters.

This issue is very rare and extremely hard to reproduce - it usually cannot be reproduced on the same machine after restarting Visual Studio for Mac. For this reason we would appreciate it if you could perform several debugging steps before restarting Visual Studio for Mac, and send the results to us.

  1. Try closing the editor tab, and re-opening it. Does it take a little bit of editing or moving the caret around until the slowdown happens again?
  2. Disable "Beam Sync" using the "Quartz Debug" developer tool (which you can find using Spotlight), and check whether the source editor performance is restored to normal.
  3. Try repeating step (1) with Beam Sync still disabled.
  4. If the editor hangs for more than a few seconds, try to run "killall -QUIT [Visual Studio for Mac]" in a terminal while it is hung. It may be difficult to time the kill command to happen while the editor is hung, but it's essential to do so, because the command forces Mono to write stack traces of all threads to the MD log, which we can use to discover what state the threads are in while the XS is hung.

Please attach the XS logs, ~/Library/Logs/XamarinStudio-{VERSION}/Ide-{TIMESTAMP}.log, AndroidTools-{TIMESTAMP}.log, and Components-{TIMESTAMP}.log * (in older versions of XS/MonoDevelop, just send *~/Library/Logs/MonoDevelop-(3.0|2.8|2.6)/MonoDevelop.log).

NOTE: The above issue was fixed in XS 2.2 Final

Compiled application is very large

In order to support debugging, debug builds contain additional code. Projects built in release mode are a fraction of the size.

As of Xamarin.iOS 1.3 the debug builds included debugging support for every single component of Mono (every method in every class of the frameworks).

With Xamarin.iOS 1.4 we will introduce a finer grained method for debugging, the default will be to only provide debugging instrumentation for your code and your libraries, and not do this for all of the Mono assemblies (this will still be possible, but you will have to opt-in to debugging those assemblies).

Installation Hangs

Both Mono and Xamarin.iOS installers hang if you have the iPhone Simulator running. This problem is not limited to Mono or Xamarin.iOS, this is a consistent problem across any software that tries to install software on MacOS Snow Leopard if the iPhone Simulator is running at installation time.

Make sure you quit the iPhone simulator and retry the installation.

Ran out of trampolines of type 0

If you get this message while running device, You can create more type 0 trampolines (type SPECIFIC) by modifying your project options "iPhone Build" section. You want to add extra arguments for the Device build targets:

-aot "ntrampolines=2048"

The default number of trampolines is 1024. Try increasing this number until you have enough for your application.

Ran out of trampolines of type 1

If you make heavy use of recursive generics, you may get this message on device. You can create more type 1 trampolines (type RGCTX) by modifying your project options "iPhone Build" section. You want to add extra arguments for the Device build targets:

-aot "nrgctx-trampolines=2048"

The default number of trampolines is 1024. Try increasing this number until you have enough for your usage of generics.

Ran out of trampolines of type 2

If you make heavy use interfaces, you may get this message on device. You can create more type 2 trampolines (type IMT Thunks) by modifying your project options "iPhone Build" section. You want to add extra arguments for the Device build targets:

-aot "nimt-trampolines=512"

The default number of IMT Thunk trampolines is 128. Try increasing this number until you have enough for your usage of interfaces.

Debugger is unable to connect with the device

When you start debugging a device configuration, you will see the debugger show a dialog indicating that it is trying to connect to the application. There are several reasons the debugger may not be able to connect to the application, depending on the mode you're using to connect (USB or WiFi).

If the device and the debugger host are on different networks, a firewall or private network may be preventing the application from connecting to the debugger host in WiFi mode.

Visual Studio for Mac may not be able to query the correct IP of the host. In WiFi mode Visual Studio for Mac gives the application all the IPs it can find of the host, and the application tries them all to see if it can use any of them to connect to Visual Studio for Mac.

Another device is connected to a USB port on the host. In a few cases other devices connected to the USB ports on the host have been known to somehow interfere with debugging in USB mode.

If either WiFi or USB mode does not work, you can easily try the other: in Visual Studio for Mac, open the Preferences, go to the Preferences/Debugger/iPhone Debugger page, and toggle the "Debug iOS devices over WiFi instead of over USB" checkbox. If neither works, you can see more information about the failure in the device console in verbose mode (which is enabled by adding "-v -v -v" to the additional mtouch arguments in the project's options).

Error 134: mtouch failed with the following message:

This error could be raised if you are trying to build with -nolink on the Xamarin.iOS 1.4 style of releases. You can work around this error by specifying Extra Arguments in your monodevelop project configuration.

Add the argument


and the problem should be resolved.

Distribution identity is not shown in Visual Studio for Mac project signing options

Visual Studio for Mac 2.2 has a bug that causes it not to detect distribution certificates that contain a comma. Please update to Visual Studio for Mac 2.2.1.

Error "AFCFileRefWrite returned: 1" during upload

While uploading an app to your device you may receive an Error "AFCFileRefWrite returned: 1". This can happen if you have a zero-length file.

Error "mtouch failed with no output"

The current release of Xamarin.iOS and Visual Studio for Mac fail when the project name or the directory where the solution or project are stored contain spaces. To fix this:

  • Make sure that neither your project or the directory where it is stored contains a space.
  • In your project "Main Settings" make sure that the Project Name does not contain any spaces.

Error "The binary you uploaded was invalid. A pre-release beta version of the SDK was used to build the application"

This error is usually caused with a project that was started in iPad development before Xamarin.iOS 2.0.0 was released, you likely have some keys in your Info.plist like:


This keypair should be removed as Visual Studio for Mac handles it for you automatically.

Error "A pre-release beta version of the SDK was used to build the app"

(Contributed by Ed Anuff)

Follow these steps:

  • Change the SDK version in iPhone Build to 3.2 or iTunes connect will reject it on upload because it is seeing an iPad compatible app built using an SDK version less than 3.2
  • Create a custom Info.plist for the project and explicitly set MinimumOSVersion to 3.0 in it. This will override the MinimumOSVersion 3.2 value set by Xamarin.iOS. If you do not do this, the app will not be able to run on an iPhone.
  • Rebuild, zip and upload to iTunes connect.

Unhandled Exception: System.Exception: Failed to find selector someSelector: on {type}

This exception is caused by one of three things:

  1. You have provided a Selector to the Objective-C runtime without applying the corresponding [Export] attribute to a method
  2. You have enabled full linking and not applied the [Preserve] attribute to the [Export]ed method.
  3. You have applied the [Export] attribute to a private method in an inherited type.

MainWindow.xib.designer.cs file is not updated

There was a bug in Xamarin Studio 2.4 that caused it not to group the MainWindow.xib file with the MainWindow.xib.designer file in new projects. This meant it would not update the designer code for that particular file.

This issue is fixed in the version of Visual Studio for Mac that's available in its built-in updater, so please ensure you use the newer version.

You can fix existing projects by removing (not deleting) the xib and its designer file, then adding it back. This should re-group the files correctly.

UIAlertView or UIActionSheet vanish after being created

If you have some code like this:

var actionSheet = new UIActionSheet ("My ActionSheet", null, null, "OK", null){
   Style = UIActionSheetStyle.Default

actionSheet.Clicked += delegate (sender, args){
    Console.WriteLine ("Clicked on item {0}", args.ButtonIndex);

the "actionSheet" object lives as a temporary variable in the function and as soon as the function terminates, the object is eligible for garbage collection, so it ends up being garbage collected.

To fix this problem, you need to keep a reference to "actionSheet" outside your method, somewhere that will live beyond your method.

Project Always Runs in the iPad Simulator

The iPhone SDK 4.0 installer installs 2 SDKs - the 3.2 SDK, for building iPad-only apps, and the 4.0 SDK, used for bulding iPhone and Universal apps. It also installs a 3.2 simulator, which simulates only an iPad, and a 4.0 simulator that simulates iPhone or iPhone 4. All older SDKs and simulators are removed.

Visual Studio for Mac iPhone project build options include a setting for the SDK version that will be used in building your app. This setting can be found in Project Options->Build->iPhone Build.

New projects in Visual Studio for Mac use the oldest installed SDK as their default SDK setting, and if the SDK specified does not exist, Visual Studio for Mac will use the closest it can find to build your app. This was done so that projects would not always requre the newest SDK. However, this currently results in the 3.2 SDK being used - which results in the iPad simulator being used.

To fix this by using the 4.0 SDK, go to Project Options->Build->iPhone Build> and change the SDK value to "4.0" using the dropdown box. You must do this for each configuration and platform combination, accessed using the dropdowns at the top of the panel.

The SDK version should not be confused with the "Minimum OS version" setting. This value does not have to match the SDK version value - it affects the minimum version of the OS your app will install on, which can be older than the SDK, as long as you use only APIs that exist in the older OS, or guard use of newer features using runtime OS version checks. You should set it to the oldest OS version on which you test your app.

Note also that the Project->iPhone Simulator Target> menu can be used to pick the simulator that is used by default when running/debugging a project. Additionally, the Run->Run With> menu can be used to pick a specific simulator with which to run

ibtool returns error 133

This means that you have XCode 4 installed. In XCode 4, the tool ibtool was removed, it is no longer possible to edit your XIB files with a standalone tool.

If you want to use Interface Builder, install XCode series 3, available from Apple's web site.

"Can't create display binding for mime type: application/"

This error happens if you try to create an iPhone UI from a non-iPhone project. Make sure that you start with an iPhone/iPad solution, it is not possible to just add iPhone UI elements to a non-iPhone/iPad project.

Startup crash when executing inside the iOS simulator

If you get a runtime crash (SIGSEGV) inside the simulator along with a stack trace that looks like this:

at (wrapper managed-to-native) System.Reflection.Assembly.GetTypes (System.Reflection.Assembly,bool)
  at MonoTouch.ObjCRuntime.Runtime.RegisterAssembly (System.Reflection.Assembly) 
  at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object (object,intptr,intptr,intptr)

...then you probably have one (or more) stale assembly in your simulator application directory. Such assemblies may exists since Apple iOS simulator adds and updates files but never deletes them. If this happens then the easiest solution is to select "Reset and Content and Settings..." from the simulator menu.

Warning: this will remove all files, applications and data from the simulator. Next time you execute your application, Visual Studio for Mac will deploy it into the simulator and there will be no old, stale assembly to cause the crash.

Simulator hangs during application installation

This can happen when application names include a '.' (dot) in their name. This is forbidden as the executable name in CFBundleExecutable - even if it can works in many other cases (like devices).

*"The value should not include any extension on the name."-

Error: "Custom attribute type 0x43 is not supported" when double clicking .xib files

This is caused by attempting to open .xib files when environment variables are set incorrectly. This should not happen with normal usage of Visual Studio for Mac/Xamarin.iOS, and re-opening Visual Studio for Mac from /Applications should fix the problem.

When attempting to update the software and this error message appears, please e-mail

Application runs on simulator but fails on device

This issue can manifest in several forms, and doesn't always produce a consistent error. If the application contains a .xib, check to make sure the Build Action on the .xib is set to InterfaceDefinition. This is the default build action for .xibs.

To check the Build Action, right click on the .xib file and choose Build Action:

System.NotSupportedException: No data is available for encoding 437

When including 3rd party libraries in your Xamarin.iOS app, you might get an error in the form "System.NotSupportedException: No data is available for encoding 437" when trying to compile and run the app. For example, libraries, such as Ionic.Zip.ZipFile, may throw this exception during operation.

This can be solved by opening the options for the Xamarin.iOS project, going to iOS Build > Internationalization and checking the West internationalization.

Can't upgrade to Indie/Business from Trial Account

If you recently purchased Xamarin.iOS and previously started a Xamarin.iOS Trial, you may need to complete the following steps to get this license change picked up by Visual Studio for Mac or Visual Studio.

  • Close Visual Studio for Mac/Visual Studio
  • Remove all files from ~/Library/MonoTouch on Mac or %PROGRAMDATA%\MonoTouch\License\ for Windows
  • Re-open Visual Studio for Mac/Visual Studio and build a Xamarin.iOS project

This should get you up and running. If you continue to have problems, you may want to try an Offline Activation to complete the activation of your workstation.

Receiving 'Activation Incomplete' Error Message

This issue may occur when using Xamarin.iOS for Visual Studio. To resolve this issue, please send the logs from the following location to

  • Log location: %LocalAppData%/Xamarin/Logs

Xamarin Workbook

If it's not already installed, install the Xamarin Workbooks app first. The workbook file should download automatically, but if it doesn't, just click to start the workbook download manually.