[UIKit] Add a custom version of UIDevice.CheckSystemVersion to Mac Catalyst. Fixes #10453.
Add a custom version of UIDevice.CheckSystemVersion that checks the iOS version for Mac Catalyst. Fixes https://github.com/xamarin/xamarin-macios/issues/10453.
This commit is contained in:
Родитель
72b50c4693
Коммит
13eceb5749
|
@ -1806,6 +1806,21 @@ namespace ObjCRuntime {
|
|||
{
|
||||
return GCHandle.ToIntPtr (GCHandle.Alloc (value));
|
||||
}
|
||||
|
||||
#if __MACCATALYST__
|
||||
static string _iOSSupportVersion;
|
||||
internal static string iOSSupportVersion {
|
||||
get {
|
||||
if (_iOSSupportVersion == null) {
|
||||
// This is how Apple does it: https://github.com/llvm/llvm-project/blob/62ec4ac90738a5f2d209ed28c822223e58aaaeb7/lldb/source/Host/macosx/objcxx/HostInfoMacOSX.mm#L100-L105
|
||||
using (var dict = NSMutableDictionary.FromFile ("/System/Library/CoreServices/SystemVersion.plist")) {
|
||||
_iOSSupportVersion = dict.ObjectForKey ((NSString) "iOSSupportVersion").ToString ();
|
||||
}
|
||||
}
|
||||
return _iOSSupportVersion;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
internal class IntPtrEqualityComparer : IEqualityComparer<IntPtr>
|
||||
|
|
|
@ -16,6 +16,8 @@ namespace UIKit {
|
|||
{
|
||||
#if WATCH
|
||||
return Runtime.CheckSystemVersion (major, minor, WatchKit.WKInterfaceDevice.CurrentDevice.SystemVersion);
|
||||
#elif __MACCATALYST__
|
||||
return Runtime.CheckSystemVersion (major, minor, Runtime.iOSSupportVersion);
|
||||
#else
|
||||
return Runtime.CheckSystemVersion (major, minor, SystemVersion);
|
||||
#endif
|
||||
|
|
Загрузка…
Ссылка в новой задаче