cordova-ios: could not find -Info.plist file, or config.xml file after adding extension, cordova build, with FIX
Bug Report
I have included the fix on the bottom. I am pretty new at Cordova, someone else should take a look.
Problem
Cannot find *-info.plist or config.xml
error when adding extension in Xcode. In a new cordova repo. After an extension is installed, depends on how you name the extension in Xcode, it will trigger a build error when running cordova build ios
How to reproduce
- Start a fresh repo
- Run all the cordova install, build commands
- Open xcode, add extension, name it
OneTwoThree
- Run cordova build
- Throws here
How did we solve it
In ios/cordova/lib/projectFile.js
, we found this.
var xcBuildConfiguration = xcodeproj.pbxXCBuildConfigurationSection();
var plist_file_entry = _.find(xcBuildConfiguration, function(entry) {
return entry.buildSettings && entry.buildSettings.INFOPLIST_FILE;
});
Log plist_file_entry
returns the path of the OneTwoThree
extension, instead of the project path.
We fixed it by adding one more condition, it basically search through that path, and find your project name by finding a file name ending with .xcworkspace
. Not sure how reliable is this.
var projectName = fs
.readdirSync(project_dir)
.find(d => d.includes(".xcworkspace"))
.replace(".xcworkspace", "");
var xcBuildConfiguration = xcodeproj.pbxXCBuildConfigurationSection();
var plist_file_entry = _.find(xcBuildConfiguration, function(entry) {
return (
entry.buildSettings &&
entry.buildSettings.INFOPLIST_FILE &&
entry.buildSettings.INFOPLIST_FILE.includes(projectName)
);
});
Environment, Platform, Device
IOS
Version information
Latest
Checklist
- I searched for existing GitHub issues
- I updated all Cordova tooling to most recent version
- I included all the necessary information above
About this issue
- Original URL
- State: open
- Created 4 years ago
- Reactions: 5
- Comments: 46 (13 by maintainers)
Commits related to this issue
- Fix build error with extensions Fix "Could not parse *-info.plist or config.xml". Proposed fix, see #764 Co-Authored-By: Leo Qiu <leogoesger@users.noreply.github.com> — committed to GEDYSIntraWare/cordova-ios by NiklasMerz 4 years ago
- Fix build error with extensions Fix "Could not parse *-info.plist or config.xml". Proposed fix, see #764 Co-Authored-By: Leo Qiu <leogoesger@users.noreply.github.com> — committed to GEDYSIntraWare/cordova-ios by NiklasMerz 4 years ago
- Fix build error with extensions Fix "Could not parse *-info.plist or config.xml". Proposed fix, see #764 Co-Authored-By: Leo Qiu <leogoesger@users.noreply.github.com> — committed to GEDYSIntraWare/cordova-ios by NiklasMerz 4 years ago
- Fix build error with extensions Fix "Could not parse *-info.plist or config.xml". Proposed fix, see #764 Co-Authored-By: Leo Qiu <leogoesger@users.noreply.github.com> — committed to GEDYSIntraWare/cordova-ios by NiklasMerz 4 years ago
- Fix build error with extensions Fix "Could not parse *-info.plist or config.xml". Proposed fix, see #764 Co-Authored-By: Leo Qiu <leogoesger@users.noreply.github.com> — committed to GEDYSIntraWare/cordova-ios by NiklasMerz 4 years ago
- Fix build error with extensions Fix "Could not parse *-info.plist or config.xml". Proposed fix, see #764 Co-Authored-By: Leo Qiu <leogoesger@users.noreply.github.com> — committed to GEDYSIntraWare/cordova-ios by NiklasMerz 4 years ago
- Fix build error with extensions Fix "Could not parse *-info.plist or config.xml". Proposed fix, see #764 Co-Authored-By: Leo Qiu <leogoesger@users.noreply.github.com> — committed to GEDYSIntraWare/cordova-ios by NiklasMerz 4 years ago
- Fix build error with extensions Fix "Could not parse *-info.plist or config.xml". Proposed fix, see #764 Co-Authored-By: Leo Qiu <leogoesger@users.noreply.github.com> — committed to GEDYSIntraWare/cordova-ios by NiklasMerz 4 years ago
- Fix build error with extensions Fix "Could not parse *-info.plist or config.xml". Proposed fix, see #764 Co-Authored-By: Leo Qiu <leogoesger@users.noreply.github.com> — committed to GEDYSIntraWare/cordova-ios by NiklasMerz 4 years ago
- Fix build error with extensions Fix "Could not parse *-info.plist or config.xml". Proposed fix, see #764 Co-Authored-By: Leo Qiu <leogoesger@users.noreply.github.com> — committed to GEDYSIntraWare/cordova-ios by NiklasMerz 4 years ago
- Fixed iOS "could not find -Info.plist file, or config.xml file" Solution was found in: https://github.com/apache/cordova-ios/issues/764 Had to change the "projectFile.js" — committed to StatisticalReinforcementLearningLab/SARAv2 by mashfiqui-rabbi 4 years ago
- Fix "Could not parse *-info.plist or config.xml". Proposed fix, see #764 Co-Authored-By: Leo Qiu <leogoesger@users.noreply.github.com> — committed to GEDYSIntraWare/cordova-ios by NiklasMerz 4 years ago
- problem in cordova-ios fix problem in cordova-ios fix as described in https://github.com/apache/cordova-ios/issues/764 — committed to luisbouca/cordova-openwith-plugin by luisbouca 4 years ago
- Fixed iOS "could not find -Info.plist file, or config.xml file" Solution was found in: https://github.com/apache/cordova-ios/issues/764 Had to change the "projectFile.js" Former-commit-id: a26f459... — committed to StatisticalReinforcementLearningLab/SARAv2 by mashfiqui-rabbi 4 years ago
- iOSビルドが不安定なことへの回避策 ref: https://github.com/apache/cordova-ios/issues/764#issuecomment-669317730 — committed to dejiren/cordova-ios by kntrs a year ago
If anyone need a quick fix, this is what worked for us. I submitted a PR a long time ago, I think everyone got busy.
ios/cordova/lib/projectFile.js, manually modify those. replace, around 43, after prettier
with
This is still a major nasty BUG. Unable to even add a plugin if we have an extension on the project. The workaround above works ok