From 3d55b230efbad33366d1fb75103adde0a9317661 Mon Sep 17 00:00:00 2001 From: Sebastien Pouliot Date: Mon, 19 Apr 2021 14:31:53 -0400 Subject: [PATCH 1/2] [maccatalyst] Increase iOS compatibility by removing `XAMCORE_3_0` `XAMCORE_3_0` was added in tvOS and watchOS where binary compatibility was not a consideration. The work to update source code for `XAMCORE_3_0` was also minimal. The former is not the always the case for MacCatalyst, while the latter is still true. Fix https://github.com/xamarin/xamarin-macios/issues/11237 and https://github.com/xamarin/xamarin-macios/issues/11236 --- src/Makefile | 4 ++-- src/UIKit/UIBarItem.cs | 12 ------------ 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/src/Makefile b/src/Makefile index 8946bdcaa8f2..87707840f9e5 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1207,10 +1207,10 @@ TVOS_TARGETS += \ # # MacCatalyst is a variant of iOS, so it defines the iOS variables as well. -MACCATALYST_DEFINES = -define:IPHONE -define:IOS -define:MONOTOUCH -d:__IOS__ -d:XAMCORE_3_0 -d:__MACCATALYST__ $(APPLETLS_DEFINES) -d:SYSTEM_NET_HTTP +MACCATALYST_DEFINES = -define:IPHONE -define:IOS -define:MONOTOUCH -d:__IOS__ -d:__MACCATALYST__ $(APPLETLS_DEFINES) -d:SYSTEM_NET_HTTP MACCATALYST_GENERATOR=$(BUILD_DIR)/common/bgen.exe MACCATALYST_GENERATE=$(SYSTEM_MONO) --debug $(MACCATALYST_GENERATOR) -MACCATALYST_GENERATED_DEFINES= -d:__MACCATALYST__ -d:XAMCORE_3_0 -d:IOS +MACCATALYST_GENERATED_DEFINES= -d:__MACCATALYST__ -d:IOS MACCATALYST_CORE_WARNINGS_TO_FIX=-nowarn:219,618,114,414,1635,3021,$(IOS_WARNINGS_THAT_YOU_SHOULD_FIX) MACCATALYST_CORE_DEFINES=$(MACCATALYST_DEFINES) -d:COREBUILD diff --git a/src/UIKit/UIBarItem.cs b/src/UIKit/UIBarItem.cs index f84d685440e6..5b58b968a068 100644 --- a/src/UIKit/UIBarItem.cs +++ b/src/UIKit/UIBarItem.cs @@ -21,18 +21,6 @@ namespace UIKit { public partial class UIBarItem { -#if __MACCATALYST__ && !NET - // This method exists to improve compatibility with assemblies that reference Xamarin.iOS.dll in Mac Catalyst, - // such as Xamarin.Forms. Setting the IsError field to true in the attribute means that everything will work at runtime, - // but that nobody can use this method at compile time. - // This is disabled in .NET because we won't try to be compatible with Xamarin.iOS.dll in .NET. - [Obsolete ("Use the overload that takes a 'UIStringAttributes' instead.", true)] - public void SetTitleTextAttributes (UIKit.UITextAttributes attributes, UIControlState state) - { - using (var dict = attributes == null ? null : attributes.Dictionary) - _SetTitleTextAttributes (dict, state); - } -#endif public void SetTitleTextAttributes (TextAttributes attributes, UIControlState state) { From 4b5ea8c5615851424d3557c42fa875f6bfa6ed16 Mon Sep 17 00:00:00 2001 From: Sebastien Pouliot Date: Mon, 19 Apr 2021 21:26:07 -0400 Subject: [PATCH 2/2] Tests have to respect that too --- tests/xharness/Targets/MacCatalystTarget.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/xharness/Targets/MacCatalystTarget.cs b/tests/xharness/Targets/MacCatalystTarget.cs index 13f5c3c412ed..17b73af63bc7 100644 --- a/tests/xharness/Targets/MacCatalystTarget.cs +++ b/tests/xharness/Targets/MacCatalystTarget.cs @@ -80,7 +80,7 @@ protected override int [] UIDeviceFamily { protected override string AdditionalDefines { get { - return "XAMCORE_3_0;__MACCATALYST__"; + return "__MACCATALYST__"; } }