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

Setting WKWebViewOnly causes cordova platform add ios to fail #725

Closed
3 tasks done
l3ender opened this issue Nov 26, 2019 · 10 comments · Fixed by #726
Closed
3 tasks done

Setting WKWebViewOnly causes cordova platform add ios to fail #725

l3ender opened this issue Nov 26, 2019 · 10 comments · Fixed by #726

Comments

@l3ender
Copy link

l3ender commented Nov 26, 2019

Bug Report

Problem

When setting WKWebViewOnly to true as an iOS platform preference (see #715), trying to run cordova platform add ios fails when the project does not have existing iOS as an existing platform.

What is expected to happen?

The command should succeed, and WKWebViewOnly should control the setting of WK_WEB_VIEW_ONLY in CordovaLib/CordovaLib.xcodeproj/project.pbxproj.

What does actually happen?

The command fails with the following error:

ENOENT: no such file or directory, open '/Users/ross/repos/my-project/platforms/ios/CordovaLib/CordovaLib.xcodeproj/project.pbxproj'

Information

Our build process removes the platforms and plugins directories prior to each build to ensure a clean slate for building. When adding the WKWebViewOnly preference, this causes the build to fail.

It seems like if iOS is already added as a platform when the WKWebViewOnly preference is added, the error does not occur.

The error not occur if the WKWebViewOnly preference is removed.

After I receive the error, I can see that the file platforms/ios/CordovaLib/CordovaLib.xcodeproj/project.pbxproj does indeed exist. So it seems like there might be some race condition where the project is trying to be modified before it is fully created?

Command or Code

I created an empty Cordova project that demonstrates the issue: https://github.com/l3ender/hello-cordova. Clone and follow steps in readme to reproduce.

If you have an existing project, you should be able to reproduce with the following:

rm -rf platforms/ plugins/
cordova platform add ios --verbose

Output from the above command:

-> cordova platform add ios --verbose
No scripts found for hook "before_platform_add".
Using cordova-fetch for cordova-ios@^5.1.0
Removing "cordova-" prefix from cordova-ios
Adding ios project...
PlatformApi successfully found for platform ios
Creating Cordova project for the iOS platform:
	Path: platforms/ios
	Package: com.example.hello
	Name: HelloWorld
Copying iOS template project to /Users/ross/repos/hello-cordova/platforms/ios
iOS project created with cordova-ios@5.1.0
Checking for any plugins added to the project that have not been installed in ios platform
No differences found between plugins added to project and installed in ios platform. Continuing...
PlatformApi successfully found for platform ios
Generating platform-specific config.xml from defaults for iOS at /Users/ross/repos/hello-cordova/platforms/ios/HelloWorld/config.xml
Merging project's config.xml into platform-specific iOS config.xml
Merging and updating files from [www, platforms/ios/platform_www] to platforms/ios/www
  mkdir platforms/ios/www/cordova-js-src
  copy  platforms/ios/platform_www/cordova-js-src/.eslintrc.yml platforms/ios/www/cordova-js-src/.eslintrc.yml (new file)
  copy  platforms/ios/platform_www/cordova-js-src/exec.js platforms/ios/www/cordova-js-src/exec.js (new file)
  copy  platforms/ios/platform_www/cordova-js-src/platform.js platforms/ios/www/cordova-js-src/platform.js (new file)
  mkdir platforms/ios/www/cordova-js-src/plugin
  mkdir platforms/ios/www/cordova-js-src/plugin/ios
  copy  platforms/ios/platform_www/cordova-js-src/plugin/ios/console.js platforms/ios/www/cordova-js-src/plugin/ios/console.js (new file)
  copy  platforms/ios/platform_www/cordova-js-src/plugin/ios/logger.js platforms/ios/www/cordova-js-src/plugin/ios/logger.js (new file)
  copy  platforms/ios/platform_www/cordova.js platforms/ios/www/cordova.js (updated file)
  copy  www/css/index.css platforms/ios/www/css/index.css (updated file)
  copy  www/js/index.js platforms/ios/www/js/index.js (updated file)
Current launch storyboard undefined
Not changing launch storyboard setting in info plist.
Wrote out iOS Bundle Version "1.0.0" to /Users/ross/repos/hello-cordova/platforms/ios/HelloWorld/HelloWorld-Info.plist
No need to update build settings for launch storyboard support.
Set PRODUCT_BUNDLE_IDENTIFIER to com.example.hello.
Set WK_WEB_VIEW_ONLY.
ENOENT: no such file or directory, open '/Users/ross/repos/hello-cordova/platforms/ios/CordovaLib/CordovaLib.xcodeproj/project.pbxproj'
Error: ENOENT: no such file or directory, open '/Users/ross/repos/hello-cordova/platforms/ios/CordovaLib/CordovaLib.xcodeproj/project.pbxproj'
    at Object.openSync (fs.js:440:3)
    at Object.readFileSync (fs.js:342:35)
    at pbxProject.parseSync (/Users/ross/repos/hello-cordova/node_modules/xcode/lib/pbxProject.js:61:28)
    at handleBuildSettings (/Users/ross/repos/hello-cordova/platforms/ios/cordova/lib/prepare.js:333:19)
    at updateProject (/Users/ross/repos/hello-cordova/platforms/ios/cordova/lib/prepare.js:234:12)
    at /Users/ross/repos/hello-cordova/platforms/ios/cordova/lib/prepare.js:59:20
    at _fulfilled (/Users/ross/repos/hello-cordova/node_modules/q/q.js:854:54)
    at /Users/ross/repos/hello-cordova/node_modules/q/q.js:883:30
    at Promise.promise.promiseDispatch (/Users/ross/repos/hello-cordova/node_modules/q/q.js:816:13)
    at /Users/ross/repos/hello-cordova/node_modules/q/q.js:570:49

Environment, Platform, Device

  • Mac OSX 10.15.1 (Catalina) with latest Xcode (11.2.1).
  • cordova-ios 5.1.0.

Version information

-> cordova -v
9.0.0 (cordova-lib@9.0.1)
-> npm -v
6.12.1
-> node -v
v12.13.1

Checklist

  • I searched for existing GitHub issues
  • I updated all Cordova tooling to most recent version
  • I included all the necessary information above
@lengyuexuan
Copy link

lengyuexuan commented Nov 26, 2019

same problem, any solution?

@ShiXihong
Copy link

I have same problem, any solution for this?

@willxw8
Copy link

willxw8 commented Nov 26, 2019

Same problem here.

@ath0mas
Copy link
Contributor

ath0mas commented Nov 26, 2019

Same problem, with this basic repro:

cordova create hello com.example.hello HelloWorld
cd hello
<<add "WKWebViewOnly" preference into config.xml>>
cordova platform add ios

fails with

...
iOS project created with cordova-ios@5.1.0
ENOENT: no such file or directory, open '/Users/foo/dev/hello/platforms/ios/CordovaLib/CordovaLib.xcodeproj/project.pbxproj'

@noahcooper
Copy link

Same problem here.

@ath0mas
Copy link
Contributor

ath0mas commented Nov 28, 2019

🚀 Could it be released in a cordova-ios@5.1.1 or is 5.2.0 coming soon?

@vitaliykoziy
Copy link

vitaliykoziy commented Nov 28, 2019

Looks like it works if to do
cordova platform add https://github.com/apache/cordova-ios

Response:

Warning: using prerelease platform ios@5.2.0-dev.
Use 'cordova platform add ios@latest' to add the latest published version instead.
Adding ios project...
Creating Cordova project for the iOS platform:
iOS project created with cordova-ios@5.2.0-dev

@noahcooper
Copy link

Is version 5.1.1 going to be published to npm? It's a release here on git (although package.json never reflected this version), and documented in release notes, but not on npm.

@dpogue
Copy link
Member

dpogue commented Dec 1, 2019

Is version 5.1.1 going to be published to npm?

When it has passed the mandatory vote process on the mailing list, it will be published.

@davutengin
Copy link

cordova platform add ios@5.1.1 solved my problem.

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 a pull request may close this issue.

9 participants