question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

could not find -Info.plist file, or config.xml file after adding extension, cordova build, with FIX

See original GitHub issue

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

  1. Start a fresh repo
  2. Run all the cordova install, build commands
  3. Open xcode, add extension, name it OneTwoThree
  4. Run cordova build
  5. 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

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:5
  • Comments:46 (13 by maintainers)

github_iconTop GitHub Comments

13reactions
leogoesgercommented, Aug 5, 2020

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

  var xcBuildConfiguration = xcodeproj.pbxXCBuildConfigurationSection();
  var plist_file_entry = _.find(xcBuildConfiguration, function(entry) {
    return entry.buildSettings && entry.buildSettings.INFOPLIST_FILE;
  });

with

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)
  );
});
2reactions
uareurapidcommented, Mar 11, 2022

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cordova ios adding extension - Error: could not find
The cordova found the wrong Info.plist. Maybe you manually created something in the platforms/ios, like some extensions or appclip.
Read more >
"could not find -Info.plist file, or config.xml file." on iOS build
Hey all, I am trying to build a project for iOS using ionic build ios and I get the error could not find...
Read more >
[Resolve]-Cordova ios adding extension - Error: could not find
Coding example for the question Cordova ios adding extension - Error: could not find -Info.plist file, or config.xml file.
Read more >
Re: Getting cordova build error after adding watch app ...
Could not find -Info.plist file, or config.xml file. issue got resolved but > throwing following exception when I run cordova build ios.
Read more >
Migrating a Web App Using Cordova to Capacitor
Initialize your app with Capacitor. Some of the information you will be prompted for is available in the Cordova config.xml file: The app...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found