PhoneGap Build Failing for iOS though It Works for Android Fine - phonegap

I tried to run the Adobe PhoneGap build for a hybrid App. It worked fine for Android but failed for iOS though everything was working OK earlier. I have updated the phonegap-version as the following:
<preference name='phonegap-version' value='cli-8.0.0' />
The error log shows the following:
copy splash.png ../../../../private/project/www/splash.png (new file)
TypeError: Cannot read property 'indexOf' of null
at parseWhitelistUrlForATS (/private/project/cordova/lib/prepare.js:1038:26)
at /private/project/cordova/lib/prepare.js:965:23
at Array.reduce (native)
at processAccessAndAllowNavigationEntries (/private/project/cordova/lib/prepare.js:956:10)
at writeATSEntries (/private/project/cordova/lib/prepare.js:1081:16)
at updateProject (/private/project/cordova/lib/prepare.js:217:15)
at /private/project/cordova/lib/prepare.js:59:20
at _fulfilled (/private/project/cordova/node_modules/q/q.js:854:54)
at self.promiseDispatch.done (/private/project/cordova/node_modules/q/q.js:883:30)
at Promise.promise.promiseDispatch (/private/project/cordova/node_modules/q/q.js:816:13)
before ending. Please help.

I just changed the CLI version to cli-6.5.0
<preference name='phonegap-version' value='cli-6.5.0' />
and it worked. It looks higher version creates issues.

Related

Unable to install Cordova plugin barcode Phonegap (mac)

I'm super new to cordova and phonegap. I need to install the Cordova plugin barcodescanner and I have tried to do so through the Terminal (mac) with the following line:
cordova plugin add cordova-plugin-barcodescanner as specified in this document.
However, I get an error that I can not solve. I've read many other posts, and haven't found a solution for my case.
My error:
(node:1721) UnhandledPromiseRejectionWarning: CordovaError: Cannot
find plugin.xml for plugin "cordova-plugin-barcodescanner". Please
try adding it again.
at new PluginInfo
(/usr/local/lib/node_modules/cordova/node_modules/cordova-
common/src/PluginInfo/PluginInfo.js:367:15)
at PluginInfoProvider.get
(/usr/local/lib/node_modules/cordova/node_modules/cordova-
common/src/PluginInfo/PluginInfoProvider.js:35:32)
at /usr/local/lib/node_modules/cordova/node_modules/cordova-
lib/src/plugman/fetch.js:177:51
at _fulfilled
(/usr/local/lib/node_modules/cordova/node_modules/cordova-
lib/node_modules/q/q.js:787:54)
at self.promiseDispatch.done
(/usr/local/lib/node_modules/cordova/node_modules/cordova-
lib/node_modules/q/q.js:816:30)
at Promise.promise.promiseDispatch
(/usr/local/lib/node_modules/cordova/node_modules/cordova-
lib/node_modules/q/q.js:749:13)
at /usr/local/lib/node_modules/cordova/node_modules/cordova-
lib/node_modules/q/q.js:509:49
at flush (/usr/local/lib/node_modules/cordova/node_modules/cordova-
lib/node_modules/q/q.js:108:17)
at _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickCallback (internal/process/next_tick.js:180:9)
(node:1721) UnhandledPromiseRejectionWarning: Unhandled promise
rejection. This error originated either by throwing inside of an
async function without a catch block, or by rejecting a promise
which
was not handled with .catch(). (rejection id: 1)
(node:1721) [DEP0018] DeprecationWarning: Unhandled promise
rejections
are deprecated. In the future, promise rejections that are not
handled
will terminate the Node.js process with a non-zero exit code.
These are my specs:
iOS: 10.13.4
Phonegap: 0.4.5
Thanks! :)
https://github.com/hypery2k/cordova-barcodescanner-plugin Try to use full url for installing plugin.
or
2.Set <plugin name="cordova-plugin-barcodescanner" spec="0.7.4" /> to config.xml and try run cordova plugin add cordova-plugin-barcodescanner with your cmd.
If it doesn't work try to run command npm install cordova-plugin-barcodescanner. (if your command already add some files to plugin folder, remove it and run it again.)
Check the path you are trying to install plugin, it must be something like C:/Desktop/Application/www/plugin/
Be sure that your config.xml have:
<config-file target="AndroidManifest.xml" parent="/*" mode="merge">
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
</config-file>
Ok, I figured out after many days and trials.
Basically what I did was create a new project from scratch, using CLI. Then I followed step by step this documentation. When I got to the "plugin" section, I added the plugin I wanted with the following line:
cordova plugin add cordova-plugin-barcodescanner
Hope this helps other people.
Cheers!

Phonegap build fails with splash screen

I'm attempting to use the new phonegap build with CLI 7.0.1
The build fails with this error:
The following build commands failed:
CompileAssetCatalog /Library/Developer/Xcode/DerivedData/Our_HNZC_Learning_space-ddfmniquktwfmabpvilymbvzreak/Build/Intermediates/ArchiveIntermediates/Our\ HNZC\ Learning\ space/InstallationBuildProductsLocation/Applications/Our\ HNZC\ Learning\ space.app Our\ HNZC\ Learning\ space/Images.xcassets
(1 failure)
Error code 65 for command: xcodebuild with args: -xcconfig,/private/project/cordova/build-release.xcconfig,-workspace,Our HNZC Learning space.xcworkspace,-scheme,Our HNZC Learning space,-configuration,Release,-destination,generic/platform=iOS,-archivePath,Our HNZC Learning space.xcarchive,archive,CONFIGURATION_BUILD_DIR=/private/project/build/device,SHARED_PRECOMPS_DIR=/private/project/build/sharedpch
I've added these to config.png
<icon src="res/icon.png" />
<splash src="res/splash.png" />
And I've added this plugin
<plugin name="cordova-plugin-splashscreen" />
And the files are in the right place.
Splash works fine, Icon is causing the error
Not sure what the exact problem is based upon the info you provided.
A starting point would be to remove the splashscreen plugin and re-add it:
cordova plugin remove cordova-plugin-splashscreen
cordova plugin add cordova-plugin-splashscreen
cordova prepare
I would suggest using an Icon and Splashscreen generator such as this one: http://phonegap.appiq.software/
It does all of the hard work for you and gives you the exact code for your config.xml
I hope this is helpful.

Cordova Plugin with third-party SDK

I'm trying to figure out how to create a Cordova iOS plugin with the PressReader framework. I'm an iOS developer and have no experience with Cordova, this is why I hope to find some guidance here.
This is what i have done:
Created a plugin
Added the Objective-C classes to src/iOS
Added the PressReader_SDK.framework to src/iOS (is this the right place ?)
Edited the src/www/js file
Edited the plugin.xml with the following in the iOS platform:
<config-file target="config.xml" parent="/widget">
<feature name="Hello">
<param name="ios-package" value="HWPHello" />
</feature>
</config-file>
<resource-file src="src/ios/PressReader_SDK.framework"/>
<framework src="src/ios/PressReader_SDK.framework" custom="true" />
<framework src="Foundation.framework"/>
<framework src="UIKit.framework"/>
<header-file src="src/ios/HWPHello.h" target-dir="HelloPlugin"/>
<source-file src="src/ios/HWPHello.m" target-dir="HelloPlugin"/>
After this I've created a new Cordova app, added the plugin and then the iOS platform.
When opening the Xcode project from platforms/iOS I get the following Build error:
error: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.1.sdk/System/Library/Frameworks/PressReader_SDK.framework: No such file or directory
Trying to run the app from terminal (cordova run ios --device) gives me the following error:
Error: Error code 65 for command: xcodebuild with args: -xcconfig,/Users/Andrei/desktop/hello/platforms/ios/cordova/build-debug.xcconfig,-workspace,Hello.xcworkspace,-scheme,Hello,-configuration,Debug,-destination,generic/platform=iOS,-archivePath,Hello.xcarchive,archive,CONFIGURATION_BUILD_DIR=/Users/Andrei/desktop/hello/platforms/ios/build/device,SHARED_PRECOMPS_DIR=/Users/Andrei/desktop/hello/platforms/ios/build/sharedpch
PS. the SDK does not seem to work on the simulator, and I need to test the app on a real device.

What is minimum ios version for ionic?

I tried to add
<preference name="deployment-target" value="6.0" />
in my config.xml and when I try to run it in xcode I get
"Thread1: signal SIGABRT" in main.m
According to Cordova official docs:
The device must have at least iOS 8 installed,
Link: https://cordova.apache.org/docs/en/latest/guide/platforms/ios/

How do I perform a remote build for iOS using PhoneGap on Windows?

This is my first hybrid App. I'm getting about a dozen of these error message
C:\Users\Chloe\workspace\TypeFunctions>phonegap remote build ios
[phonegap] compressing the app...
rm: could not remove file (code EBUSY): C:\Users\Chloe\workspace\TypeFunctions\build\www/lib/images/icons-svg/mail-black.svg
There is only 1 search result on the entire web.
My target platform is Windows 8.1. I am using PhoneGap 5.4.0.
Strange, I tried it again, but now I got a different error. No mention of what the error was though. Terrible software.
C:\Users\Chloe\workspace\TypeFunctions>phonegap remote build ios
[phonegap] compressing the app...
skipping existing file: mail-black.svg
skipping existing file: tag-white.svg
skipping existing file: user-black.svg
skipping existing file: user-white.svg
[phonegap] uploading the app...
[phonegap] building the app...
[error] error occured while building the ios app
I managed to get a stack trace.
Error: ENOTEMPTY: directory not empty, rmdir 'C:\Users\Chloe\workspace\TypeFunctions\build'
at rethrow (fs.js:48:21)
at maybeCallback (fs.js:66:42)
at Object.fs.rmdir (fs.js:797:14)
at Object.module.exports.cleanup (C:\Users\Chloe\AppData\Roaming\npm\node_modules\phonegap\node_modules\phonegap-build\lib\phonegap-build\create\zip.js:119:16)
at Object.callback (C:\Users\Chloe\AppData\Roaming\npm\node_modules\phonegap\node_modules\phonegap-build\lib\phonegap-build\build\remote.js:71:21)
at Request._callback (C:\Users\Chloe\AppData\Roaming\npm\node_modules\phonegap\node_modules\phonegap-build-api\lib\api.js:229:26)
at Request.self.callback (C:\Users\Chloe\AppData\Roaming\npm\node_modules\phonegap\node_modules\phonegap-build-api\node_modules\request\main.js:122:22)
at emitTwo (events.js:87:13)
at Request.emit (events.js:172:7)
at Request. (C:\Users\Chloe\AppData\Roaming\npm\node_modules\phonegap\node_modules\phonegap-build-api\node_modules\request\main.js:655:16)
Additional Information
The EBUSY and ENOTEMPTY errors were caused by guard running. It might be possible to have it run with -w option.
I'm still getting the [error] error occured while building the ios app without reason. I'm using PhoneGap CLI and PhoneGap Build. I thought that part was obvious with the actual command line provided. The target platform was iOS. I thought that was given away by the command line too. The (default) platform tags in config.xml are
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
</platform>
<engine name="ios" spec="~3.9.2" />
The app was created with the jQuery template and command phonegap create myApp --template jquery-mobile-starter and then modified.

Resources