l3ender opened a new issue #725: Setting WKWebViewOnly causes `cordova platform add ios` to fail URL: https://github.com/apache/cordova-ios/issues/725 # Bug Report ## Problem When setting `WKWebViewOnly` to `true` as an iOS platform preference (see https://github.com/apache/cordova-ios/pull/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: ```bash rm -rf platforms/ plugins/ cordova platform add ios --verbose ``` Output from the above command: ```bash -> 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 [email protected] 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 ```bash -> cordova -v 9.0.0 ([email protected]) -> npm -v 6.12.1 -> node -v v12.13.1 ``` ## Checklist - [x] I searched for existing GitHub issues - [x] I updated all Cordova tooling to most recent version - [x] I included all the necessary information above
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
