-
Notifications
You must be signed in to change notification settings - Fork 987
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
Copy deployment-target from root config.xml to platform-specific config.xml before usage in Podfile #1422
Comments
This was an issue in cordova-ios 6.3 but I believe was patched in 7.0 (definitely in 7.1). I have a google maps plugin that requires iOS 15 and I used to manually workaround this issue but it was corrected after I updated my projects to 7.1. I used: <platform name="ios">
<preference name="deployment-target" value="15.0" />
</platform> adding the plugin and then the platform works as expected, with the generated podfile properly containing
The expectation of "any script or process" is not quite right. The platform files (including config.xml and Podfile) gets updated during the I can not reproduce the issue using the current version of cordova-ios. Simply adding a plugin in which requires a higher deployment target of 11 is not enough to reproduce the issue. If you can provide a sample reproduction project, it may help us understanding the full scope of when the issue reproduces. |
breautek hi! thanks a lot for your activity here. FBSDKCoreKit https://github.com/CocoaPods/Specs/blob/master/Specs/9/b/5/FBSDKCoreKit/17.0.0/FBSDKCoreKit.podspec.json#L13 is required 12.0
|
I still could not reproduce the issue. The config.xml gets copied into platform resources pretty early on in the prepare step. I don't quite remember exactly where it happens in the code. But here's what I did: I've created a test plugin to wrap around the podspec, the test plugin is effectively just has an empty package.json and the <?xml version="1.0" encoding="UTF-8"?>
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
xmlns:rim="http://www.blackberry.com/ns/widgets"
xmlns:android="http://schemas.android.com/apk/res/android"
id="test-plugin"
version="5.0.1-dev">
<name>test</name>
<description>Cordova test Plugin</description>
<platform name="ios">
<podspec>
<config>
<source url="https://cdn.cocoapods.org/" />
</config>
<pods use-frameworks="true">
<pod name="FBSDKCoreKit" spec="17.0.0"/>
</pods>
</podspec>
</platform>
</plugin> I In a test cordova project, which was empty with no platforms or plugins installed with a base config.xml: <?xml version='1.0' encoding='utf-8'?>
<widget id="io.cordova.hellocordova" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>HelloCordova</name>
<description>Sample Apache Cordova App</description>
<author email="[email protected]" href="https://cordova.apache.org">
Apache Cordova Team
</author>
<content src="index.html" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
</widget> I added my test-plugin using a command like: The plugin gets added successfully. Not installed at this point because there are no platforms. Just added to the project. Then I add the platform: The platform is added successfully, but it does fail to completley install the test plugin because the default deployment target is 11.0, as expected since we didn't explicitly declare an alternate So we modify our config.xml and add: <preference name="deployment-target" value="12.0" /> and then run |
I think expected if I do clean build and have inside my main config.xml |
I don't think If you're still reproducing the issue then confirm that you're running the latest cordova CLI and platform version and share sample project that reproduces the issue that we can look at. If a sample reproduction project cannot be provided then I don't think there's anything we can do to move this forward. |
Reproduction case with order of steps where pod installation fails is at my repository with cordova-ios 7.1.1. What triggers it is if we have config.xml and package.json configured with the plugin which requires increased deployment-target and then we run
The reason for this order is in prepare.js. The order here is:
There are two solutions i can think of:
Edit:
|
Issue
Currently, the deployment-target variable is not being copied from the root config.xml file to the platforms/ios/[App Name]/config.xml before it is accessed in the code. As a result, the script uses the default deployment target from the template (https://github.com/apache/cordova-ios/blob/rel/7.0.1/templates/project/__PROJECT_NAME__/config.xml) instead of the user-specified value in the root config.xml.
It is mean in Podfile we will have deployment-target from root config.xml only first successful prepare hook.
Reproduce is very easy: try to install any pod library with ios target version more than 11. -> you will have error
Expected Behavior
The deployment-target set in the root config.xml should be reflected in the platforms/ios/[App Name]/config.xml before any script or process accesses it.
Proposed Solution
Modify the lib/prepare.js file to ensure that deployment-target and possibly other preferences are copied from the root config.xml to the platforms/ios/[App Name]/config.xml early in the preparation process. This could potentially be implemented at line 250, before the preferences are required by subsequent processes in the script.
Additional Information
This change will ensure that the deployment target and other settings are correctly set according to the project's configuration before they are needed, preventing any default settings from causing conflicts or errors during build or runtime.
Workaround:
this.minDeploymentTarget = minDeploymentTarget || '13.0';
The text was updated successfully, but these errors were encountered: