Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add preference to disable MacOS target #1274

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

tiagoappereira
Copy link

Xcode 14 considers that iOS apps should support by default not only iPhone and iPad, but also Mac (with Apple Silicon processors). With the introduction of “Designed for iPad“, IPAs can be installed on these devices, and Apple wants to make this the default behaviour/experience.

Also, when apps with the Mac target are submitted to the App Store they are available for Mac by default as well. They can be found in a specific “iPhone & iPad Apps“ tab.

Therefore, with the suggested preference in this PR, developers can disable the aforementioned default behaviour.

Description

To disable Mac target, the following lines need to be added to the .pbxproj:

SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;

The Mac support removal (or not) is controlled by a preference called SupportMac:

SupportMac Mac target
N/A enabled
true enabled
false disabled

Testing

Created a local iOS Cordova project based on this cordova-ios branch and the .pbxproj was:

  • NOT updated when the preference SupportMac is not set
  • NOT updated when the preference SupportMac is set with the value true
  • updated when the preference SupportMac is set with the value false

Checklist

  • I've run the tests to see all new and existing tests pass
  • I added automated test coverage as appropriate for this change
  • Commit is prefixed with (platform) if this change only applies to one platform (e.g. (android))
  • If this Pull Request resolves an issue, I linked to the issue in the text above (and used the correct keyword to close issues using keywords)
  • I've updated the documentation if necessary

@breautek breautek added this to the 7.0.0 milestone Dec 5, 2022
tests/spec/unit/prepare.spec.js Outdated Show resolved Hide resolved
tests/spec/unit/prepare.spec.js Outdated Show resolved Hide resolved
tests/spec/unit/prepare.spec.js Outdated Show resolved Hide resolved
@dpogue
Copy link
Member

dpogue commented Dec 6, 2022

We have an existing target-device preference that supports handset, tablet, and universal as values, and sets the TARGETED_DEVICE_FAMILY.

Maybe we can find a way to add this functionality to that existing preference?

@tiagoappereira
Copy link
Author

We have an existing target-device preference that supports handset, tablet, and universal as values, and sets the TARGETED_DEVICE_FAMILY.

Maybe we can find a way to add this functionality to that existing preference?

If the idea is to expand the target-device supported values, doing so would change what the preference represents. From the official documentation

This property maps directly to TARGETED_DEVICE_FAMILY in the xcode project.

which would no longer be true.

@dpogue
Copy link
Member

dpogue commented Dec 6, 2022

The documentation can be updated to reflect what the preference actually does, so I wouldn't worry too much about that aspect.

I don't have strong feelings about it, but I do wonder if it's easier or more consistent to have a single preference that controls the output platforms (similar to the 3 checkboxes in Xcode) vs a combination of multiple preferences that might interact in unusual ways.

@dpogue
Copy link
Member

dpogue commented Jun 6, 2023

My current thinking around this is to disable the iPad-on-macOS thing by default, and to allow explicitly building a macOS app from the same codebase targeting Catalyst. That means there would be an extra step for those who want to distribute a macOS app, but it should be a better result (in terms of user experience and platform fit) than the iPad-on-macOS option.

@dpogue dpogue modified the milestones: 7.0.0, 7.1.0 Jun 6, 2023
@dpogue dpogue modified the milestones: 7.1.0, 7.1.1 May 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants