Phonegap/Cordova 3.4 update gives multiple errors - ios

After upgrading to Cordova 3.4 from 3.3 I get the following error:
Shell Script Invocation Error Group
Cp: ....../platforms/ios/myproject/config.xml: No such file or directory
Command /bin/sh emitted errors but did not return a nonzero exit code to indicate failure.
This is relating to the running of cordova/lib/copy-www-build-step.sh from build phases.
This doesn't result in the build to fail, but still concerns me...
Anyone know a fix for this?
BTW the config.xml it can't find definitely exists.

Remove platform and add it back again.
Remove
cordova platform rm ios
Add
cordova platform add ios

Related

ionic Cordova platform add iOS fails

I'm trying to run the command
ionic cordova platform add ios#6.2.0
everything is updated, my versions are:
ionic - 6.17.1
npm - 7.21.1
node - 16.9.1
pod - 1.11.2
I have the last version of Xcode (13) just released 2 days ago. When running that command I get:
--save flag or autosave detected
Saving ios#~6.2.0 into config.xml file ...
Update IOS build setting SWIFT_OBJC_BRIDGING_HEADER to: "$(PROJECT_DIR)/$(PROJECT_NAME)/Bridging-Header.h" for build configuration Debug
Update IOS build setting SWIFT_OBJC_BRIDGING_HEADER to: "$(PROJECT_DIR)/$(PROJECT_NAME)/Bridging-Header.h" for build configuration Release
Update IOS build setting ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES to: YES for build configuration Debug
Use Swift language version 5
Update IOS build setting SWIFT_OPTIMIZATION_LEVEL to: -Onone for build configuration Debug
Update IOS build setting ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES to: YES for build configuration Release
Use Swift language version 5
[ERROR] An error occurred while running subprocess cordova.
cordova platform add ios#6.2.0 exited with exit code 1.
After reading every post I found, I included on my config.xml:
<preference name="UseSwiftLanguageVersion" value="5" />
Thinking I might had a non-supported Xcode version, I downgraded Xcode to v12.5.1, selected it on Xcode -> Preferences -> Locations, then restarted all terminals and processes, restarted the Mac, but still not working.
I tried to update CocoaPods with the commands:
pod install
pod setup
And still nothing was working so I decided to run the command
ionic cordova prepare ios
to see if I could go on anyway but got this error:
[error] Error: Cannot find module '#ionic/angular-toolkit/package.json'
Require stack:
- /usr/local/lib/node_modules/#angular/cli/node_modules/#angular-devkit/architect/node/node-modules-architect-host.js
- /usr/local/lib/node_modules/#angular/cli/node_modules/#angular-devkit/architect/node/index.js
- /usr/local/lib/node_modules/#angular/cli/models/architect-command.js
- /usr/local/lib/node_modules/#angular/cli/commands/run-impl.js
- /usr/local/lib/node_modules/#angular/cli/node_modules/#angular-devkit/schematics/tools/export-ref.js
- /usr/local/lib/node_modules/#angular/cli/node_modules/#angular-devkit/schematics/tools/index.js
- /usr/local/lib/node_modules/#angular/cli/utilities/json-schema.js
- /usr/local/lib/node_modules/#angular/cli/models/command-runner.js
- /usr/local/lib/node_modules/#angular/cli/lib/cli/index.js
- /usr/local/lib/node_modules/#angular/cli/lib/init.js
- /usr/local/lib/node_modules/#angular/cli/bin/ng
And yes, if you are wondering every time I updated or ran a command I did also deleted the platforms, plugins, node_modules and www folder, but anything is happening.
Coincidentally today I had to migrate a Cordova project to iOS 6.2 due to Apple's usual annoyance in updating hours before and leaving everything obsolete (the best in backward compatibility, it should be noted).
I'll share with you the short commands that work with cordova without digging too much:
0-) sudo npm install cordova-ios#latest
1-) sudo ionic cordova platform remove ios
2-) sudo ionic cordova platform add ios#latest // don't specify version, the last one already assumes this
3-) sudo chmod -R 777 platforms/ios // usually, I must enable read and write permissions, things on my computer but with that I ensure full permission.
4-) sudo ionic cordova build ios
5-) You open XCode again in the generated project and voila, you can compile it.
If step #1 fails you, run it 2 times (for some reason I always have to run it 2 times to get it done).
Best regards.
Well, at the end, after 15h of work and a lot of searching, it was all fixed by downgrading my Node version from 16.9.1 to 14.17.5.
I didn't know that this new Node version is not supported by Angular jet, but I found out, and you can too by just running the command
ng -v
which says at the end
Warning: The current version of Node (16.9.1) is not supported by Angular.
to downgrade your Node version you can follow the instructions on this post:
How to downgrade Node version
You can also see all the Node versions available here:
https://nodejs.org/es/about/releases/
Since Angular is a step behind of Node I suggest to download an Active version and not a current one.

ionic fails to add iOS platform

when I try the following command in VS Code
sudo ionic cordova platform add iOS
I get an error with the following:
ERROR] An error occurred while running subprocess cordova.
cordova platform add ios exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.
I get iOS folder in platforms folder, but how to solve this error ?
First, why are you running with sudo? I would recreate the project in a directory which does not require this. For example ~/dev/myProjectName
Second, when you scroll up it should give a more specific error.
Third, if not have you tried doing as shown and run with --verbose flag?
Fourth, try opening platform/ios project in xCode and running from there. It may give more useful info.

Run Custom Shell Script [cp] Embed Pods Framework

My Project was building fine before the latest update of xcode.Currently running 10.1 version of xcode and high sierra below are the errors screenshot
It's hard to say what is wrong without script. By error description bad interpreter: Operation not permitted I can have a guess you have syntax error in script or one of commands in script requires sudo.

React-Native: Build error GeneratedInfoPlistDotEnv.h file not found

I had a old React-Native project which I wanted to give it a try again and when trying to run the project on iOS (Android works perfect) I get the error that Debug-iphonesimulator/GeneratedInfoPlistDotEnv.h file not found.
If I run the project from the command react-native run-ios, than the build will succeed.
What can cause this issue and how can it be fixed?
I have tried to fix it with the comments from this issue but no success.
React-Native verision: 0.47
Full error:
<built-in>:1:10: fatal error:
'/Users/myUser/Library/Developer/Xcode/DerivedData/Project-gcaxrvbcwgkfhkadevoqxcprxszw/Build/Products/Debug-iphonesimulator/GeneratedInfoPlistDotEnv.h' file not found
I fixed by copying file GeneratedInfoPlistDotEnv.h (in /ios/build/Build/Products/) to the path mentioned in the error message.
The path mentioned in error message for simulator is not same as real phone, you need to copy for a second time.
The development for React Native just like droped in a deep black hole, what you need to do is just climb and climb and climb...
Changing the Info.plist preprocessor prefix file to works for me ${CONFIGURATION_BUILD_DIR}/../GeneratedInfoPlistDotEnv.h
Image of code in Xcode 9
If you're coming from React version 0.60 and above, you should be referencing the package from GitHub instead of NPM. The author hasn't released auto-linking support on NPM yet, even though it's already merged!?
Try these steps after you unlink and uninstall the existing version of react-native-config. Remember to revert to default Info.plist preprocessor settings in XCode build settings.
yarn add https://github.com/luggit/react-native-config.git
cd ios && pod install
You don't have to add any other post-install scripts, just run the app like usual and it should work fine. Make sure you undo any other fixes before doing this.

React-native - Build failed due to double-conversion

I have created new react-native project through terminal.
react-native init PlayWithAnimation
when I run the react-native app through Xcode. I got this error.
/bin/sh -c \"/Users/sumit/Desktop/React\ Native/RNN/ios/build/Build/Intermediates/React.build/Debug-iphonesimulator/double-conversion.build/Script-190EE32F1E6A43DE00A8543A.sh\"
/Users/sumit/Desktop/React >Native/RNN/ios/build/Build/Intermediates/React.build/Debug-iphonesimulator/double-conversion.build/Script-190EE32F1E6A43DE00A8543A.sh: line 2: cd: /Users/sumit/Desktop/React: No such file or directory
/Users/sumit/Desktop/React >Native/RNN/ios/build/Build/Intermediates/React.build/Debug-iphonesimulator/double-conversion.build/Script-190EE32F1E6A43DE00A8543A.sh: line 3: /Users/sumit/Desktop/React Native/RNN/node_modules/react-native/React/scripts/ios-install-third-party.sh: No such file or directory
/Users/sumit/Desktop/React
Native/RNN/ios/build/Build/Intermediates/React.build/Debug-iphonesimulator/double-conversion.build/Script-190EE32F1E6A43DE00A8543A.sh: line 3: exec: /Users/sumit/Desktop/React Native/RNN/node_modules/react-native/React/scripts/ios-install-third-party.sh: cannot execute: No such file or directory
The following build commands failed:
PhaseScriptExecution Install\ Third\ Party /Users/sumit/Desktop/React\
Native/RNN/ios/build/Build/Intermediates/React.build/Debug-iphonesimulator/double-conversion.build/Script-190EE32F1E6A43DE00A8543A.sh
(1 failure)
These are the version which I have used:
node v8.0.0
npm 5.0.3
react-native-cli: 2.0.1
react-native: 0.46.0
xcode 8.3.3
I have checked related to other stackoverflow Q & A but did't get proper solution.
Temporary Solution:
It works smoothly if I create react-native with version="0.44.0". But in version 0.45.0, 0.46.0, 0.47.0 builds are failed and same "double-conversion" issue is getting. And one more thing, when I create new project third-party directory is missing.
node_modules/react-native/ (missing third-party directory)
What would be the problem ?
Tried Solution 1:
I did the following steps:
download the files needed inside the .sh, put it in the ~/.rncache/.
copy the downloaded files into node_modules/react-native/third-party/, ran tar -zxf *** to each file.
build again. But not worked.
Tried Solution 2:
Handling third party build error on react-native 0.46x.
and tried with github issue.
I was really excited to finally get started with React Native but this bug absolutely kills my ability to proceed. I'd really appreciate if someone could help me out with this.
Got the solution from jerry han here: The life saver
Hi Bala, As you can see the error log, That error was from ‘WhiteSpace’ on your working path.
Real Path : /Users/sumit/Desktop/React\ Native/
On cd cmd log : /Users/sumit/Desktop/React:
You should rename your working path to ‘/Users/sumit/Desktop/react_native’.
That will be helpful for you.
With developing or operation work, you may be better not to use ‘space’ on the path.
For me, what worked was just updating the Code Signing preference in Xcode to something different and back again.
E.g. I have Automatically manage signing originally turned on. Turning that off and back on again seems to resolve this issue.

Resources