Unified API

PDF for offline use
Related Articles:

Let us know how you feel about this

Translation Quality


last updated: 2016-04

The new style API makes it easier than ever to share code between Mac and iOS as well as allowing you to support 32 and 64 bit applications with the same binary.

To improve code sharing between Mac and iOS and to enable developers to have a single code base that works on 32 and 64 bits, in early 2015 we introduced a new API in both Xamarin.Mac and Xamarin.iOS products called the Unified API.

Classic Profile Deprecation: As new platforms are added in Xamarin.iOS we are starting to gradually deprecate features from the classic profile (monotouch.dll). For example, the non-NRC (new-ref-count) option was removed. NRC has always been enabled for all unified applications (i.e. non-NRC was never an option) and has no known issues. Future releases will remove the option of using Boehm as the garbage collector. This was also an option never available to unified applications. The complete removal of classic support is scheduled for next fall with the release of Xamarin.iOS 10.0.


Describes the rationale behind the Unified API and explains the differences from the Classic API in detail. Refer to this page to understand the changes that have been made in the Unified API.

Updating Classic API-based Apps

Follow the relevant instructions for your platform:

Tips for Updating Code to the Unified API

Regardless of what applications you are migrating, check out these tips to help you successfully update to the Unified API.

The Road to 64 Bits

For background on supporting 32 and 64 bit applications and information about frameworks see the 32 and 64 bit Platform Considerations.

New Data Types

At the core of the difference, both Mac and iOS APIs use an architecture-specific data types that are always 32 bit on 32 bit platforms and 64 bit on 64 bit platforms.

For example, Objective-C maps the NSInteger data type to int32_t on 32 bit systems and to int64_t on 64 bit systems.

To match this behavior, on our Unified API, we are replacing the previous uses of int (which in .NET is defined as always being System.Int32) to a new data type: System.nint. You can think of the "n" as meaning "native", so the native integer type of the platform.

We are introducing nint, nuint and nfloat as well providing data types built on top of them where necessary.

To learn more about these data type changes, see the Native Types document.

How to detect the architecture of iOS apps

There might be situations where your application needs to know if it is running on a 32 bit or a 64 bit iOS system. The following code can be used to check the architecture:

if (IntPtr.Size == 4) {
    Console.WriteLine ("32-bit App");
} else if (IntPtr.Size == 8) {
    Console.WriteLine ("64-bit App");

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.