How to build a cordova project in xcode? - ios

I want to build my cordova project so I can publish it in the app store.
when i load the project from ./src-cordova/platforms/ios/myapp.xcodeproj in xcode
And I want to build it I get the following error
error: Build input file cannot be found: '/Users/user/Projects/git/myapp/src-cordova/platforms/ios/CordovaLib/Cordova/Info.plist' (in target 'Cordova' from project 'CordovaLib')
I tried to change the project properties to legacy build and changed the built option Any iOS device (arm64) and any mac (silicon,intel) but still get the same error.
What to I have to do to build the app so that I can publish it.

The solution was to delete the cordova project and reinstall it cordova platform rm ios and then cordova platform add ios

Related

Build commands failed: CompileAssetCatalog - Cordova for iOS

After setting up a fresh Cordova for iOS project trough the CLI this error comes up.
Build commands failed: CompileAssetCatalog
/Users/a/example/example/platforms/ios/build/emulator/Example.app
/Users/a/example/example/platforms/ios/Example/Images.xcassets
(1 failure) xcodebuild: Command failed with exit code 65
Cordova Version: 9.0.0 (cordova-lib#9.0.1)
Xcode Version: 11.2.1
macOS Version: 10.15
CLI:
cordova create example com.example.app Example
(cd example)
cordova platform add ios
cordova emulate ios --target="iPhone-6-Plus, 9.3"
What I tried:
- Clean up build folder
- Update Node/NPM
- Update Xcode
P.S.: Does it make a difference if the .ipa gets build trough the Cordova CLI or from within Xcode?
Two things here:
If you are using cordova 9.0.0, I'm assuming you're also using cordova-ios 5+. In that case, the "-UseModernBuildSystem=0" in your build.json is no longer necessary. cordova-ios#5 supports the modern build system.
You should also remove the target: --target="iPhone-6-Plus, 9.3". XCode 11 no longer, by default, ships with iOS9 simulators. In fact, you should not specify a target at all, unless necessary.
If you're still facing problems after fixing these two issues, try opening and running your project via XCode, it is likely to provide an improved error log and possible hints to fixes.
there is meny approach that getting resolve exit code 67
1) method 1
cordova platform remove ios
cordova platform add ios
2) in xcode give your provision profile check
You need a development provisioning profile on your build machine.
Apps can run on the simulator without a profile, but they are required
to run on an actual device
https://cordova.apache.org/docs/en/latest/guide/platforms/ios/
3) cordova platform update ios
further informations cordova run with ios error .. Error code 65 for command: xcodebuild with args:
I have solved this issue in Xcode, by creating new
"iOS App Icon". Name it whatever you want, but you must choose it from dropdown in project's settings ie target settings, parameter is "App icons source". Then copy all images via Finder into that folder, and in Xcode
connect(drag&drop) those uncategorised images into placeholders.

Build iOS app from Cordova Command Line

When building and uploading a iOS app our approach is like this.
Create the mobile app and put the Cordova configuration
run cordova platform add ios then basically load the generated folder / project into XCode
Configure and select the Signing on XCode
Use XCode to build the iOS app and upload the Archive to TestFlight
In what way all these can be done with the Cordova command-line?

Xcode does not include changes in rebuild of cordova app

I am experiencing the problem that Xcode does not incorporate any changes made to HTML/CSS/JS files when rebuilding the app for iOS
Right now I am deleting the whole platforms/ios folder and rerunning cordova add platform ios every time. This can't be the intended way of testing cordova apps. What is a good workflow for testing cordova apps on an iOS device?
Well, the recommended workflow for testing Cordova apps is not using Xcode at all, just use the Cordova CLI to run your apps. But the truth is that running from the CLI might be slower than using Xcode.
What you need to copy the changes from www to the Xcode project is to run cordova prepare ios before running from Xcode. You can do it manually or create a Xcode build script to run it for you.
To add a build script, on Xcode select your project target, go to Build Phases, click the + button and select New Build Script phase.
You can try to just add cordova prepare ios and this might work.
If you get a cordova command not found, then you also need to add Cordova path to your PATH. To do it, open a terminal and type which cordova, you'll get the Cordova path, something like /Users/davidnathan/.nvm/versions/node/v4.4.7/bin/cordova.
Now add that path without the cordova part to your build script before the cordova prepare ios, something like
PATH=/Users/davidnathan/.nvm/versions/node/v4.4.7/bin/:$PATH && cordova prepare ios
Move the build script to be over the existing "Copy www directory"
Try ionic cordova prepare ios.

Cordova 5 not handling new ios application target in XCode

I just upgraded to Cordova 5. Any XCode project that has more than one application target causes an error on build.
cordova build ios
could not find -Info.plist file, or config.xml file.
Steps to recreate:
Create a new Cordova project
Add iOS as a platform
In the XCode project, duplicate the application target to create a new target
Run "cordova build ios"
Currently using XCode 6.3.2 and Cordova 5.1.1
There is a pull request with a fix: https://github.com/apache/cordova-lib/pull/219
Until Cordova team fix it, look here:
Second answer

PhoneGap CLI "cordova build ios" failed

i have created a new hello world project using the following command,
cordova create hello com.example.hello HelloWorld
the project is created successfully, then i add the ios platform by
cordova platform add ios
and to verify i have it added correctly, i type
cordova platform list
the iOS platform is shown in the list. so at this point, according to the PhoneGap tutorial, i can use the command
cordova build ios
to build the iOS version of the project. however, i encounter the following error:
Generating config.xml from defaults for platform "ios"
Preparing ios project
Compiling app on platform "ios" via command "/Users/Aldour/PhoneGap/hello/platforms/ios/cordova/build"
/usr/local/lib/node_modules/cordova/node_modules/q/q.js:126
throw e;
^
Error: An error occurred while building the ios project.
at ChildProcess.<anonymous> (/usr/local/lib/node_modules/cordova/src/compile.js:65:22)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:735:16)
at Socket.<anonymous> (child_process.js:948:11)
at Socket.EventEmitter.emit (events.js:95:17)
at Pipe.close (net.js:466:12)
the results that i have googled are mostly concerning the android version, talking about the invalid environment path setting. i dont know if it is related since i can create and build a PhoneGap project targeting the android platform without problem.
here is my $PATH:
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/bin/node:/usr/local/bin/npm:/Developer/SDKs/android-sdk-macosx/platform-tools:/Developer/SDKs/android-sdk-macosx/tools
EDIT:
problem solved by re-installing xcode from app store
I had the same problem in Android platform, and it was solved with the commands:
cordova platform rm android
cordova platform add android
cordova build android
in Node.Js console. try it in ios.
If you get an error with 'cordova platform add android', you may need to manually remove any android folders in your project folder hierarchy.
This resolved my issue:
cordova platform remove ios
cordova platform add ios
cordova build ios
If you run the build with --verbose, you will probably see some permission issues. By default, XCode creates a folder of the build in ~/Developer, if you haven't changed it. There probably is a permissions issue when creating that folder. Just execute the following command: sudo cordova bulid ios
That should fix your issue.

Resources