方法 'UIKit.UIApplication.Main' 已过时:使用带有 'Type' 而不是 'String' 参数的重载以确保类型安全 [英] Method 'UIKit.UIApplication.Main' is obsolete: Use the overload with 'Type' instead of 'String' parameters for type safety
本文介绍了方法 'UIKit.UIApplication.Main' 已过时:使用带有 'Type' 而不是 'String' 参数的重载以确保类型安全的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
将我的 Xamarin.Forms 版本升级到 5.0.0.2244 后,我在 iOS 项目中的 Main.cs
文件中收到以下警告:
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.
这是我的 Main.cs
文件:
using UIKit;
namespace LindeGctMobileApplication.iOS
{
public class Application
{
private static void Main(string[] args)
{
UIApplication.Main(args, null, "AppDelegate"); // << warning
}
}
}
我需要更改什么才能删除此警告?
What I need to change to remove this warning?
推荐答案
现在不推荐通过字符串引用类.您需要更改此行:
Class reference through a string is now deprecated. You need to change this line:
UIApplication.Main(args, null, "AppDelegate");
为此:
UIApplication.Main(args, null, typeof(AppDelegate));
通过这种方式,您可以明确告知类的类型.
In that way, you explicitly inform the type of the class.
这篇关于方法 'UIKit.UIApplication.Main' 已过时:使用带有 'Type' 而不是 'String' 参数的重载以确保类型安全的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文