xamarin - 方法 'UIKit.UIApplication.Main' 已过时 : Use the overload with 'Type' instead of 'String' parameters for type safety

标签 xamarin xamarin.forms xamarin.ios

将我的 Xamarin.Forms 版本升级到 5.0.0.2244 后,我在 Main.cs 中收到以下警告我的 iOS 项目中的文件:

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
        }
    }
}
我需要更改什么才能删除此警告?

最佳答案

现在不推荐通过字符串引用类。您需要更改此行:

UIApplication.Main(args, null, "AppDelegate");
对此:
UIApplication.Main(args, null, typeof(AppDelegate));
通过这种方式,您明确告知类的类型。

关于xamarin - 方法 'UIKit.UIApplication.Main' 已过时 : Use the overload with 'Type' instead of 'String' parameters for type safety,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70011243/

相关文章:

ios - 使用默认的 MonoTouch 解决方案会产生构建错误

ios - 尾部截断不适用于自定义 Xamarin.iOS TableView 单元格

c# - 如何在 Xamarin.Forms.Map 中获取当前位置或移动到当前位置

ios - 应用程序在后台时未立即调用 DidReceiveRemoteNotification

xamarin.forms - Xamarin Forms - 每 10 秒获取一次设备位置(当应用程序在前台/后台运行时)

ios - TabBar - 导航回根级别

android - UnsatisfiedLinkError : No implementation found for void mono. android.text.TextWatcherImplementor

c# - Xamarin 中的日志记录库和 MetroLog 中的错误报告样式

mvvm - 对于 Xamarin.Forms 中的 MVVM,哪个更好?共同观点还是平台特定观点?

ios - 如何在 Xamarin.Forms ios 中更改工具栏图标颜色