Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot build project for iOS from cordova cli

I've created a project using Cordova CLI, version 3.5.0.

I've successfully deployed the project for Android platform by using the CLI.

cordova run android

However, I'm having problem to deploy the project for iOS.

cordova run ios

I encountered this error:

mv: dest file already exists: /Users/amirfazwan/Documents/workspace/MyPKS/platforms/ios/MYPKS/MyPKS-Info.plist

mv: dest file already exists: /Users/amirfazwan/Documents/workspace/MyPKS/platforms/ios/MYPKS/MyPKS-Prefix.pch

shell.js: internal error
Error: EINVAL, invalid argument '/Users/amirfazwan/Documents/workspace/MyPKS/platforms/ios/MYPKS.xcodeproj'
    at Object.fs.renameSync (fs.js:543:18)
    at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/shelljs/shell.js:495:8
    at Array.forEach (native)
    at Object._mv (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/shelljs/shell.js:471:11)
    at Object.mv (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/shelljs/shell.js:1491:23)
    at pbxProject. (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/metadata/ios_parser.js:126:27)
    at pbxProject.EventEmitter.emit (events.js:98:17)
    at pbxProject. (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/xcode/lib/pbxProject.js:30:18)
    at ChildProcess.EventEmitter.emit (events.js:98:17)
    at handleMessage (child_process.js:322:10)

This problem only occur after I access the Xcode project manually to add the Icon & splash screen since the icon & splash screens are not automatically added to the project even though declared in config.xml.

I've tried to remove the Info.plist & Prefix.pch file, but then this error appeared.

Error: ENOENT, no such file or directory '/Users/amirfazwan/Documents/workspace/MyPKS/platforms/ios/MYPKS/MYPKS-Info.plist'
    at Object.fs.openSync (fs.js:427:18)
    at Object.fs.readFileSync (fs.js:284:15)
    at Object.exports.parseFileSync (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/plist-with-patches/lib/plist.js:18:19)
    at Object.module.exports.update_from_config (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/metadata/ios_parser.js:66:31)
    at Object.module.exports.update_project (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/metadata/ios_parser.js:189:21)
    at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/prepare.js:113:31
    at _fulfilled (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:798:54)
    at self.promiseDispatch.done (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:827:30)
    at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:760:13)

The project works just fine if launched from Xcode, but I no longer can build the project from CLI or launch the "serve" command from CLI for debugging purpose.

Please guide me, thanks.


SOLVED

Solved by renaming the project name using Xcode. Thanks Jason for the tips.

wwwww

like image 300
Amir Fazwan Avatar asked Aug 13 '14 09:08

Amir Fazwan


People also ask

Does Cordova work for iOS?

You can use cordova run ios --list to see all available targets and cordova run ios --target=target_name to run application on a specific device or emulator (for example, cordova run ios --target="iPhone-6" ). You can also use cordova run --help to see additional build and run options.

Do you need Xcode for Cordova?

iOS Device You can test many of the Cordova features using the iOS simulator that is installed with the iOS SDK and Xcode, but you will need an actual device to fully test all of the device features used in your applications before submitting to the App Store. The device must have at least iOS 5.


1 Answers

Just remove the platforms and then add them again.

cordova platform rm ios
cordova platform rm android
cordova platform add ios
cordova platform add android
like image 87
Chris S Avatar answered Oct 15 '22 19:10

Chris S