Reputation: 3716
In my xamarin forms project I run my xamarin ios part for the first time, but getting the following Exception:
Foundation.MonoTouchException has been thrown Objective-C exception thrown. Name: NSInternalInconsistencyException Reason: Unable to instantiate the UIApplication delegate instance. No class named AppDelegate is loaded.
AppDelegate.cs
using System;
using System.Collections.Generic;
using System.Linq;
using Foundation;
using UIKit;
namespace Myapp.iOS
{
// The UIApplicationDelegate for the application. This class is responsible for launching the
// User Interface of the application, as well as listening (and optionally responding) to
// application events from iOS.
[Register("AppDelegate")]
public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate
{
//
// This method is invoked when the application has loaded and is ready to run. In this
// method you should instantiate the window, load the UI into it and then make the window
// visible.
//
// You have 17 seconds to return from this method, or iOS will terminate your application.
//
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
global::Xamarin.Forms.Forms.Init();
LoadApplication(new App(""));
return base.FinishedLaunching(app, options);
}
}
}
Main.cs
using System;
using System.Collections.Generic;
using System.Linq;
using Foundation;
using UIKit;
namespace Myapp.iOS
{
public class Application
{
// This is the main entry point of the application.
static void Main(string[] args)
{
// if you want to use a different Application Delegate class from "AppDelegate"
// you can specify it here.
UIApplication.Main(args, null, "AppDelegate");
}
}
}
Thanks in advance
Upvotes: 1
Views: 1052
Reputation: 3716
I Solve this issue by setting the Build Action property of AppDelegate.cs to Combile
Upvotes: 0