發表文章

目前顯示的是有「Cordova」標籤的文章

Cordova iOS with Failed to load webpage with error: Could not connect to the server.

This problem is caused by the transport security policy changed on iOS9. It affects the UIWebView of iOS9. New WKWebView is not affected by this problem. Check if the cordova-ios version is larger than 4.0: cordova platform version ios If cordova-ios is larher than 4.0, please use  Cordova   WKWebView   Engine   with   http   server   ( localhost ) support:  https://github.com/apache/cordova-plugins/tree/master/wkwebview-engine-localhost cordova plugin add https :// github . com / apache / cordova-plugins . git # master : wkwebview-engine-localhost Add the following tag in config.xml if using WKWebView: <feature name="CDVWKWebViewEngine"> <param name="ios-package" value="CDVWKWebViewEngine" /> </feature> <preference name="CordovaWebViewEngine" value="CDVWKWebViewEngine" /> You must specify the wkwebview server port on config.xml for ios using indexdb or localstorage (port e.g. 12344 ) rather th...

The resource could not be loaded because the App Transport Security policy requires the use of a secure connection

Transport security   is provided in iOS 9.0 or later, and in OS X v10.11 and later. So by default only   https   calls only allowed in apps. To turn off App Transport Security add following lines in   info.plist   file... NSAppTransportSecurity NSAllowsArbitraryLoads For more info: https://developer.apple.com/library/prerelease/ios/technotes/App-Transport-Security-Technote/   Reference: http://stackoverflow.com/questions/32631184/the-resource-could-not-be-loaded-because-the-app-transport-security-policy-requi

Failed to run ionic plugin with node.js 0.12.x

Failed to run ionic plugin with node.js 0.12.x Scenrio: npm http GET https://registry.npmjs.org/cordova-plugin-geolocation TypeError: Request path contains unescaped characters.     at new ClientRequest (_http_client.js:73:11)     at TunnelingAgent.exports.request (http.js:49:10)     at TunnelingAgent.createSocket (C:\Users\cst548\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\npm\node_modules\request\node _modules\tunnel-agent\index.js:117:25)     at TunnelingAgent.createSecureSocket [as createSocket] (C:\Users\cst548\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\npm\n ode_modules\request\node_modules\tunnel-agent\index.js:184:41)     at TunnelingAgent.addRequest (C:\Users\cst548\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\npm\node_modules\request\node_m odules\tunnel-agent\index.js:80:8)     at new ClientRequest (...

Make phone call with Cordova for Hybrid application

Make phone call with Cordova for Hybrid application Method 1: tel: protocol (open a native dialer) With regular HTML hyperlink element: Call me or using angularjs directive: Call me Add the explicit whitelist permission on config.xml < access origin = "tel:*" launch-external = "yes" /> < access origin = "mailto:*" launch-external = "yes" /> Cordova Whitelist Guide Method 2: Cordova Plugin CordovaCallNumberPlugin Call a number directly from your cordova application. Install the plugin using: cordova plugin add https : //github.com/Rohfosho/CordovaCallNumberPlugin.git Use the plugin in your JS file: window . plugins .CallNumber.callNumber(onSuccess, onError , number); Make sure to create onSuccess and onError call back functions. Reference:  https://github.com/rohfosho/CordovaCallNumberPlugin

Ionic CLI Guide

Install the Ionic CLI npm install -g ionic Update Ionic lib ionic lib update bower update Starting an Ionic App ionic start -a [appName] [path] - t [ template(tabs|sidemenu|blank) ] Testing in a Browser ionic serve [ options ] ionic serve --lab ( Ionic Lab is a feature on top of  ionic serve  that makes it easy to test your app in a phone frame and with iOS and Android platforms side-by-side. ) Specifying an IP Address to use ionic serve --address 68.54.96.105 Adding a platform target ionic platform ios android Building your app ionic build ios Live Reload App During Development (beta) The  run  or  emulate  command will deploy the app to the specified platform devices/emulators. You can also run  live reload  on the specified platform device by adding the  --livereload  option. The live reload functionality is similar to  ionic serve , but instead of developing and d...