[UIKit] The default UIDocViewController constructor is unusable, so prevent any usage.

This commit is contained in:
Rolf Bjarne Kvinge 2024-06-26 16:40:10 +02:00
Родитель b7d3e54f26
Коммит 30201b38ca
2 изменённых файлов: 19 добавлений и 0 удалений

Просмотреть файл

@ -9,6 +9,8 @@
//
using System;
using System.ComponentModel;
using CoreGraphics;
using Foundation;
using ObjCRuntime;
@ -207,4 +209,19 @@ namespace UIKit {
}
}
#endif
#if !XAMCORE_5_0 && IOS
public partial class UIDocViewController {
[Obsolete ("Do not use; this constructor doesn't work.")]
[EditorBrowsable (EditorBrowsableState.Never)]
public UIDocViewController ()
: base (ThrowInvalidOperationException ())
{
}
static NSObjectFlag ThrowInvalidOperationException ()
{
throw new InvalidOperationException ("Do not call this constructor, it may crash the app.");
}
}
#endif
}

Просмотреть файл

@ -28127,8 +28127,10 @@ namespace UIKit {
}
[NoWatch, NoTV, iOS (17, 0), MacCatalyst (17, 0)]
[DisableDefaultCtor] // It crashes the app.
#if XAMCORE_5_0
[BaseType (typeof(UIViewController))]
[Abstract] // "UIDocumentViewController is an abstract base class that is meant to be subclassed."
interface UIDocumentViewController
#else
[BaseType (typeof (UIViewController), Name = "UIDocumentViewController")]