Phonegap 3.3.0 config.xml parsing error - ios

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.

Related

IONIC 5 - InAppBrowser is not installed or you are running on a browser -XCODE 13

I have an IONIC 5 / cordova project and I use InAppBrowser to open a link.
In the next code:
const browser = this.iab.create(url);
I get error "WARN: InAppBrowser is not installed or you are running on a browser. Falling back to window.open" on execution time in IOS device and IOS emulator.
I have tried all kinds of things that I have found on the internet:
First, I have done many test with #ionic-native/in-app-browser plugin, but I always get the same result:
Remove node_modules, www, platform/ios
Re-install(remove and install) in-app-browser libraries
Recompile in dev and prod mode.
Same error..
I have tried it again with the new plugin:
$ ionic cordova plugin add cordova-plugin-inappbrowser
$ npm install #awesome-cordova-plugins/in-app-browser
I change the code to get the new native plugin
$ ionic cordova platform add ios
BUILD DEVEL and PROD
$ ionic cordova build ios
$ ionic cordova build ios --prod
Same result.
I have verified that the cordova plugins are installed in the /Plugins folder of the XCode project.
I have a couple of things to comment on:
Now I use XCode 13, but In XCode 12 works fine. To upgrade the XCode I have upgrade MacOS from Catalina To Monterey.
The only difference between the two projects is that in XCode 13 "Legacy build system" is disabled since it's "deprecated".
I don't know if XCode doesn't import the libraries, I don't know if "Legacy Build System" is necessary. I know nothing... :-(
Can anybody help me?
Thanks.
I found the problem.
In my project I have an "Object.prototype" function that it produce a big problem to loop objects.
Referring InAppBrowser pluguin, in file inappbrowser.js:
callbacks = callbacks || {};
for (var callbackName in callbacks) {
iab.addEventListener(callbackName, callbacks[callbackName]);
}
Perhaps it could be improved with an Object.keys(callbacks), but I think that It was my problem.
Thanks.

Apache Cordova, Visual Studio 2015, Xcode 8.3 cannot remotebuild

It has been a year since I first build the app, and of course my iPhone software has updated since then. With that I was informed that I needed to update Xcode in order to get the right platform to get a release version for my cordova app updates. Updating xcode required me to update the OS to Sierra on the mac. After that, I have been unable to remotebuild even my debug version, which I had been able to do before.
My constant issue right now is that when I build the app in remote build it keeps adding "ios": "4.0.1" to the platforms.json file, but the error I receive is that with xcode 8.3 I need 4.3.0 or greater.
I cannot figure out how to update this value. I have upgraded npm, node, everything that I can think of. Nothing changes the value, and I can't seem to find anyone else with my problem.
Any help or suggestions would be welcome.
First, open up project platforms folder and delete ios folder. Then update cordova on your development machine and Mac.
For Mac : $ sudo npm install -g cordova
For Windows: npm install -g cordova
Just check whether your files getting deployed to the Mac build folder path. If so, open up the project using XCode.
Then build your project using XCODE. Most probably there will be an error to choose the development team. Once you select the account or the team fom dropdown list you can deploy the app without any issues.
That worked for me. Hope this will help you too.
Another way: Navigate to platforms folder -> platforms.json. Check the IOS version. Change it to 4.3.0 and delete the ios folder and add IOS 4.3.0 via command prompt.
packages.json
{
"android": "5.1.1",
"ios": "4.3.0"
}
in cmd Run
cordova platform add ios#4.3.0
Well, be ready for many actions to be done but in the end it works. )
Update your XCode to 8.3.3 without worry.
Then be sure to update your remotebuild to the latest version that is currently 2.1.3 by running sudo npm i remotebuild -g on your Mac.
Get back to your development machine with Visual Studio and run some command line utility in administrator mode. Open you cordova folder from there.
Execute cordova platform rm ios to remove the current ios version under cordova. It's also advised to remove the android one by cordova platform rm android.
Update the version of CLI you use for builidng on Visual Studio. Currently it's 7.0.1. There were people that claimed that 6.5.0 also works but in my setup 7.0.1 works as well.
Get back to your command line and run cordova platform add ios#4.4.0, This is the minimal cordova ios that supports the cordova 7.0.1.
In case you removed android as well then run cordova platform add android#6.0.0. There are more progressive versions of cordova android but I found them not working.
Now get back to your Mac and remove the following folder ~/.taco-remote/node_modules.
In case you don't see this .taco-remote folder it's the hidden one so run in command line of your Mac com.apple.Finder AppleShowAllFiles true and then killall Finder to close all instances of Finder. Afterwards .taco-remote folder should be visible under your user folder ~/.
Now go back to Visual Studio and open Tools > Options > Tools for Apache Cordova and run Clear Cordova cache.
Now run your ios and it should succeed.
In case you run afterwards your android build and it fails on something like Android platform already added run the Clear cordova cache again and then your android build also should succeed.
From this point both ios and android builds should work.
Whooof. )
Good luck!
BTW, most of this solution came from this thread.

Unable to compile Phonegap app locally

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.

Phonegap still getting whitelist rejection after modifying config.xml

I generated a cordova xcode project with sencha cmd. But now I'm trying to run it, but I'm getting the whitelist rejection error, although I have already edited www/config.xml.
My phonegap version is 3.4.0-0.19.8.
Please tell me if you need more info.
Thank you very much for your help!
Look for a copy of config.xml in the Staging group in the XCode project. As QuickFix suggested, you will need to run cordova build ios or cordova prepare ios command from your application directory. This will update the files located in the Staging group.

How to include phonegap application in the iOS

I am creating a phonegap application in ios and i am following below mentioned link
http://docs.phonegap.com/en/1.9.0/guide_getting-started_ios_index.md.html
It is said in the link that we need to download the phone gap, which i had done already
and then click on the cordova based application, but in my app I am not getting the options
to select the same.
So can anyone suggest how it can be done?
PhoneGap installation process has been changed. You will not get any template in Xcode and we can do is creating app in terminal
List of this you need to install phoneGap are
1. node.js
2. cordova
3. phonegap
first install node.js and then phone gap/cordova
once your installation is completed open terminal and then create a cordova based application
use this for creating process
http://cordova.apache.org/docs/en/3.3.0/guide_cli_index.md.html
this for plugins
http://docs.phonegap.com/en/3.4.0/cordova_plugins_pluginapis.md.html#Plugin%20APIs
cd to your workspace
cd /Users/xxxx/Desktop
create cordova project
cordova create your-project-name
cd to your project
cd your-project-name
add ios platform
cordova platform add ios
build your project using cordova build
cordova build ios
done !!
Reference: http://blog.revivalx.com/2014/02/21/crud-operation-using-jquery-mobile-on-android-part-1/

Resources