Problems with UIApplicationDelegate versus FormsApplicationDelegate after update to unified IOS

After updating the Xamarin IOS project to unified IOS using Xamarin Studio 5.7.1 (build 17) xamarin.IOS 8.6.1.26 on a Mac, I get some compiling errors.

the system reports :

error CS0012: The type `MonoTouch.UIKit.UIImageView' is defined in an assembly that is not referenced. Consider adding a reference to assembly `monotouch, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065' 

and

error CS0012: The type `MonoTouch.UIKit.UIView' is defined in an assembly that is not referenced. Consider adding a reference to assembly `monotouch, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065'

both errors occur on the same line:

        public class ImageCircleRenderer : ImageRenderer

This part is a copy of the article which is published a month or so ago about using circular images within your App.

the app delegate has another strange message:

AppDelegate.cs(21,75): error CS0012: The type `MonoTouch.UIKit.UIApplicationDelegate' is defined in an assembly that is not referenced. Consider adding a reference to assembly `monotouch, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065'

While the class declaration within the AppDelegate is:

    [Register("AppDelegate")]
    public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate

image

I'm using the following nuget packages:
Microsoft.Bcl
Microsoft.Bcl.Build
Microsoft.Net.Http
PCLStorage
Xam.Plugins.Settings
Xamarin.Forms
Xamarin.Insights

Reregistering the all but the Microsoft packages didn't solve the problem and as far as I can see, none of the csproj files have any mentioning of the Foundation class.

is there somebody who can help me with these problems?

Greetings,

Posts

  • TCRespondTCRespond NLMember ✭✭
    edited February 2015

    After examining the other issue, about can't import Xamarin.forms since it's already imported and again scanning the csproj files, I noticed that the system had in one or two projects a double import defined for Xamarin forms.

    the first one:

    <Import Project="..\..\packages\Xamarin.Forms.1.3.4.6332\build\portable-win+net45+wp80+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets" Condition="Exists('..\..\packages\Xamarin.Forms.1.3.4.6332\build\portable-win+net45+wp80+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets')" />
      <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
        <PropertyGroup>
          <ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
        </PropertyGroup>
        <Error Condition="!Exists('..\..\packages\Xamarin.Forms.1.3.4.6332\build\portable-win+net45+wp80+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Xamarin.Forms.1.3.4.6332\build\portable-win+net45+wp80+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets'))" />
        <Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
      </Target>
    

    And almost at the end another one:

      <Import Project="..\..\packages\Xamarin.Forms.1.3.4.6332\build\portable-win+net45+wp80+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets" Condition="Exists('..\..\packages\Xamarin.Forms.1.3.4.6332\build\portable-win+net45+wp80+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets')" />
    

    Why there were two references in the project file, I don't know, but it might be that the first one with the additional Target element isn't detected correctly by the system when the upgrade was done using the Migrate to Unified App option in the project menu.
    anyway due to some other strange misfortune I ended up with two import references, even while these references were removed and added just prior to the migration.

    At first glance this might have been the solution to my problem, but the errors are still there and the project is still not compiling correctly.

Sign In or Register to comment.