Skip to content

Commit

Permalink
[maccatalyst] Increase iOS compatibility by removing XAMCORE_3_0 (#…
Browse files Browse the repository at this point in the history
…11238)

`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 #11237 and #11236
  • Loading branch information
spouliot authored Apr 20, 2021
1 parent dec81b6 commit 7d2b389
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 15 deletions.
4 changes: 2 additions & 2 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 0 additions & 12 deletions src/UIKit/UIBarItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
2 changes: 1 addition & 1 deletion tests/xharness/Targets/MacCatalystTarget.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ protected override int [] UIDeviceFamily {

protected override string AdditionalDefines {
get {
return "XAMCORE_3_0;__MACCATALYST__";
return "__MACCATALYST__";
}
}

Expand Down

1 comment on commit 7d2b389

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ Tests failed on Build ❌

Tests failed on Build.

API diff

✅ API Diff from stable

View API diff

Packages generated

View packages

Test results

2 tests failed, 180 tests passed.

Failed tests

  • Xtro/Mac: BuildFailure
  • introspection/watchOS 32-bits - simulator/Debug (watchOS 5.0): LaunchFailure

Pipeline on Agent XAMBOT-1017
[maccatalyst] Increase iOS compatibility by removing XAMCORE_3_0 (#11238)

Please sign in to comment.