Closed homerlex closed 2 years ago
Generally speaking, we don't support cordova-ios platform on windows as Apple does not provide the necessary toolchains for windows to begin with... so it doesn't make much sense to platform add ios
on a windows environment.
But since there's already a PR and this particular issue appears to be trivial, I don't see why we can't accept a patch for it so :+1:
Thanks @breautek . The problem in my case is not that I am doing platform add ios
on Windows. I am doing an update to a plugin and my project happens to have Android and iOS platforms. Without the fix we are forced to do plugin upgrades on OSX. Yes, its just an inconvenience but the trivial fix is most welcomed!
We build for Android and iOS, but our developers primarily use Windows. Only those actually working on the iOS native code are using Macs. We don't store the platforms in the repository: we rely on cordova prepare
to restore them. If you attempt to restore the iOS platform on Windows, you run into the same bug, as one of our plugins is written in Swift, and has a BridgingHeader.
In this situation, the workaround is to explicitly prepare only the platforms that are compatible that are in your project, listing them on the cordova prepare
command line, e.g.:
cordova prepare android windows browser
instead of just
cordova prepare
I agree that it isn't particularly useful to restore the iOS platform on Windows, but it is the default behaviour.
Bug Report
Problem
We have a Cordova app with both Android and iOS platforms. One of the plugins we use has a BridgingHeader on the iOS side. Adding/Removing this plugin on OSX (and probably Linux) works fine. However, trying to add or remove this plugin from a Windows command line yields the following error:
BridgingHeader.h is not found.
NOTE: Plugins that do not have a BridgingHeader can be added and removed using the Windows command line without a problem.
What is expected to happen?
Expecting to be able to add/remove the plugin from Windows command line.
What does actually happen?
Not able to add/remove the plugin from Windows command line.
Information
I've tracked the problem down to the lines of code that try to extract the project name: https://github.com/apache/cordova-ios/blob/a3a3936a549981054dabff8098dfa393094eb834/bin/templates/scripts/cordova/Api.js#L261 https://github.com/apache/cordova-ios/blob/a3a3936a549981054dabff8098dfa393094eb834/bin/templates/scripts/cordova/Api.js#L309
The forward slash in the following code will not work for extracting the project name when in a Windows console:
const project_name = this.locations.xcodeCordovaProj.split('/').pop();
Command or Code
Run the following commands to add or remove a plugin that has a BridgingHeader:
cordova plugin add cordova-plugin-<of-your-choice>
cordova plugin rm cordova-plugin-<of-your-choice>
Environment, Platform, Device
Windows 10 Platforms: android 9.0.0, ios 6.2.0 Cordova: 10.0.0
Version information
Windows 10 Platforms: android 9.0.0, ios 6.2.0 Cordova: 10.0.0
Checklist