Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Method 'UIKit.UIApplication.Main' is obsolete: Use the overload with 'Type' instead of 'String' parameters for type safety

After upgrade my Xamarin.Forms version to 5.0.0.2244, I'm getting the following warning in Main.cs file inside my iOS project:

Method UIKit.UIApplication.Main is obsolete: Use the overload with Type instead of String parameters for type safety.

This my Main.cs file:

using UIKit;

namespace LindeGctMobileApplication.iOS
{
    public class Application
    {
        private static void Main(string[] args)
        {
            UIApplication.Main(args, null, "AppDelegate"); // << warning
        }
    }
}

What do I need to change to remove this warning?

like image 685
Ângelo Polotto Avatar asked Dec 12 '25 06:12

Ângelo Polotto


1 Answers

Class reference through a string is now deprecated. You need to change this line:

UIApplication.Main(args, null, "AppDelegate");

to this:

UIApplication.Main(args, null, typeof(AppDelegate));

In that way, you explicitly inform the type of the class.

like image 173
Ângelo Polotto Avatar answered Dec 14 '25 04:12

Ângelo Polotto



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!