Unable to compile Phonegap app locally - ios

I'm unable to compile my app for iOS locally, Android works OK.
I have installed both cordova and phonegap using npm install -g [...]. I am running OSX (10.7.5).
Version outputs from both:
$ cordova -v
5.1.1
$ phonegap -v
0.9.4
I have XCode installed (v 4.6.2). I also have the command-line tools installed.
Both the cordova and phonegap tools fail to build, seemingly for the same reason. Running phonegap build ios outputs:
$ phonegap build ios
phonegap detecting iOS SDK environment...
phonegap using the local environment
phonegap compiling iOS...
error ENOENT, no such file or directory '/Users/mike/apps/***/platforms/ios/__CLI__/config.xml'
Here is the output from the same cordova command:
$ cordova build ios
cp: copyFileSync: could not write to dest file (code=ENOENT):/Users/mike/apps/***/platforms/ios/__CLI__/config.xml
cp: no such file or directory: /Users/mike/apps/***/platforms/ios/platform_www/*
Parsing /Users/mike/apps/***/platforms/ios/__CLI__/config.xml failed
Error: ENOENT, no such file or directory '/Users/mike/apps/***/platforms/ios/__CLI__/config.xml'
at Error (native)
at Object.fs.openSync (fs.js:500:18)
at Object.fs.readFileSync (fs.js:352:15)
at Object.module.exports.parseElementtreeSync (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/util/xml-helpers.js:118:27)
at Object.ConfigParser (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/configparser/ConfigParser.js:33:24)
at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/prepare.js:115:32
at Array.map (native)
at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/prepare.js:70:40
at _fulfilled (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:787:54)
at self.promiseDispatch.done (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:816:30)
It seems to me that there should be some replacement running on __CLI__ in the path that isn't happening, but it's difficult to tell. Below is a screenshot of the file structure this generates:
I am able to build using the remote build service, but it's quite laborious, as the app isn't properly loading so I need to do quite a bit of debugging to sort this out.
Node is installed at version 0.12.5. NPM is installed at version 2.11.2.
I have reinstalled the platform numerous times, and always get this error.

This question is a little old, but I'll throw a few things out there:
I've got a command line build of my ios platform running -- it does not have an __CLI__... subdirectory. Just a data point.
I'm wondering if there isn't something weird with the way Xcode is set up in relation to its build path. See this answer to make sure the output directory is set correctly: still getting <Cordova/CDVViewController.h> file not found error in xcode. I've got a desktop and mobile app set up in Xcode, and I have to remember to switch this setting back and forth.
PhoneGap / Cordova have been phasing out older versions of ios with their newer releases. It would not surprise me if cordova 5.1.1 did not support Xcode 4.6.2. You might want to try with an older release of the cordova library.

Related

Ionic build fails Info.plist not found

Apple has tricked me and even though I disabled autoupdates it now pulled the most recent XCode version (Version 10.0 (10A255)) and dependencies. The effect is that I can not build my app anymore, even after removing (ionic cordova platform remove ios) and re-adding the platform.
It now fails with the error below.
onic cordova run ios --debug --target="iPhone-8" --consolelogs
...
<path>/platforms/ios/build/emulator/MyApp.app/Info.plist file not found.
[ERROR] An error occurred while running cordova run ios --debug --target iPhone-8 (exit code 1).
ionic --version
3.20.0
---- EDIT
ran with verbose and received :No scripts found for hook "before_deploy". as additional info for the failure.
----- EDIT ------
Please look here for more detail. I was able to reproduce it from scratch / a blank app template
Blank app fails debug build - /Info.plist file not found
ionic cordova emulate ios -- --buildFlag="-UseModernBuildSystem=0"
Try this command it should work,this is issue with cordova.
If you're building on the command-line, try this
ionic cordova emulate ios -- --buildFlag="-UseModernBuildSystem=0"
or
Xcode 10
If you are opening the project in the Xcode IDE, you need to change the build system in Workspace Settings to "Legacy Build System"
Xcode example
Now, You can also run this on command-line $ionic cordova build ios
Best of luck

Determining cause of cordova iOS build failure

My cordova phone application is building and running well in android, and now I'd like to build for ios. I can't do this in my linux environment, so I'm using a mini-mac with the Xcode tools installed.
I cloned the git repo to a working tree, and I'm running
cordova build ios
In the build output, I'm getting the following, with "fatal error", "BUILD FAILED" and "Error: ..." in red.
/Users/mgfrobozz/Desktop/asap_cordova/platforms/ios/ASAP Media/Plugins/org.apache.cordova.dialogs/CDVNotification.m:21:9: fatal error:
'Cordova/NSDictionary+Extensions.h' file not found
I found https://issues.apache.org/jira/browse/CB-8659, which indicated this issue (deprecated dependency in ios) was resolved in cordova 4.0.0, but I'm running cordova 6.0.0.
I don't know enough about the cordova guts to know how to fix CDVNotification.
Any suggestions?
Try the command: cordova platform update ios

Creating iPhone app using phonegap on Windows7

C:\soft\my-app>phonegap create something
[phonegap] create called with the options C:\soft\my-app\something com.phonegap.helloworld HelloWorld
[phonegap] Customizing default config.xml file
[phonegap] created project at C:\soft\my-app\something
cd something
C:\soft\my-app\something>phonegap build ios
[phonegap] detecting iOS SDK environment...
[phonegap] using the local environment
[phonegap] adding the iOS platform...
{ [CordovaError: Applications for platform ios can not be built on this OS - win32.]
name: 'CordovaError',
message: 'Applications for platform ios can not be built on this OS - win32.' }
[error] Applications for platform ios can not be built on this OS - win32.
[phonegap] using the remote environment
{ [Error: ENOENT, open 'C:\soft\my-app\something\www\config.xml']
errno: 34,
code: 'ENOENT',
path: 'C:\\soft\\my-app\\something\\www\\config.xml' }
[error] ENOENT, open 'C:\soft\my-app\something\www\config.xml'
When I look at windows information (Right click on my computer) it shows windows OS as 64 bit.
What could be causing this issue ? I am trying to develop iphone app on windows 7. I installed node.js and phonegap using following command: npm install -g phonegap
Do I need to install cordova ?
What Scott Hunter said isn't entirely true, you can build IOS using windows.
It will use phonegap build to compile the code as is shown by this line "[phonegap] using the remote environment"
I am having the same issue as OP though, I'm thinking its a bug. As I haven't had issues in the past and just recently upgraded and tried to create a new project.
Edit: Downgrading to an older version should work, its looking like:
npm -g install phonegap#3.5.0-0.21.18
You can't build an iOS app on anything other than Mac OSX.

Phonegap 3.3.0 config.xml parsing error

It looks to me that Phonegap 3.3.0 broken. I do:
$ cordova create app de.app.name "app-name"
$ cd app
$ cordova platform add ios
Open the xcode project in platforms/ios/*.xcodeproj and run it (xcode 5.0.2). I get an Exception with a parsing error for config.xml.
I notice that www/config.xml and platforms/ios/www/config.xml are broken. There is some binary empty space at the end of the file. Removing that fixes the error but still I cannot install any plugins.
Does anyone else have this problem? How can I fix this?
Update
If I stick with phonegap commands things looking better:
$ phonegap create app de.app.name "app-name"
$ cd app
$ phonegap local build ios
config.xml looks fine now and does contain much more. platforms/ios/www/config.xml is bigger but still has the broken ending. Also plugin installation still does not work.
Update 2
Found a nice tutorial with does demand to use cordova instead of phonegap and does something like this:
cordova create App com.App.Name App
cd App
cordova platform add ios
cordova build ios
cordova plugin add org.apache.cordova.console
But still platforms/ios/www/config.xml is broken before I add the plugin and even with fixed config.xml it still throws the error. Same same. Also I tried reinstalling phonegap & cordova and restarting the Mac.
Problem is caused by the directory I am in. If I did cd ~ and run the same command it just works!
I was in \Volumes/www with is a samba share mounted over smbfs.

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