Forum Xamarin.Forms

The type `MonoTouch.UIKit.UIViewController' is defined Error when I convert to Unified API

I have created a new Xamarin.Forms.Portable project.
After that I wanted to convert MYProjectName.IOS to Unified by going to Project > Migrate to Xamarin Unified API

So I did that and removed all MonoTouch name references.
Next, when I try to compile this project I am getting this error message.

Can you please help. Error is on this line of code:

window.RootViewController = App.GetMainPage().CreateViewController();

Error Message:
The type MonoTouch.UIKit.UIViewController' is defined in an assembly that is not referenced. Consider adding a reference to assemblymonotouch, Version=, Culture=neutral, PublicKeyToken=84e04ff9cfb79065' (CS0012)

Thank You


  • ShantimohanElchuriShantimohanElchuri USMember ✭✭✭✭✭

    4 things you will have to do here.

    1. Remove the Xamarin.Forms package and get Xamarin.Forms v1.3.1 (that is V1.3 pre-release) from NuGet.
    2. Replace "using monotouch.UIKit" with "using UIKit" in AppDelelgate.cs & main.cs
    3. Replace "using monotouch.Foundation" with "using Foundateio" in AppDelegate.cs & main.cs
    4. Replace the code in AppDelegate class with that described in [this article](

    I learnt it a little hard way.

  • AdnanKhanAdnanKhan USMember ✭✭

    Shantimohan ,

    Thanks for sharing. I did go to NuGet from Xamarin Studio.
    I do not see v1.3.1. Even i click on show pre-release packages. Anything I am missing here?
    My NuGet points to :

    Thank You.

  • CraigDunnCraigDunn USXamarin Team Xamurai

    @AdnanKhan‌ here's the nuget link to 1.3.1. Try selecting the 'pre-release' option and then searching again for Xamarin.Forms in the NuGet Manager window.

    @ShantimohanElchuri‌ to be clear, you do not have to manually perform steps 2. and 3. if you use the migration tool built in to Xamarin Studio (as explained in the article you linked on upgrading Xamarin.Forms apps) those changes should be done automatically.

  • AdnanKhanAdnanKhan USMember ✭✭

    Thanks Craig & Shantimohan for your help. I was only missing step #1. Step #2 and #3 was automatically done on my project using Xamarin Studio migration tool. Now project is successfully compiled by following steps per Craig's instructions.
    "Try selecting the 'pre-release' option and then searching again for Xamarin.Forms in the NuGet Manager window."

  • ShantimohanElchuriShantimohanElchuri USMember ✭✭✭✭✭

    @CraigDunn‌ I don't know why, but unfortunately it didn't do it automatically for me. Trust me I did follow the steps in the page linked above. I will check again with few other old projects that I have.

Sign In or Register to comment.