Why tel:* links don't work on ios? - ios

I added this to config.xml
<access origin="*"/>
<access origin="tel:*" launch-external="yes"/>
<access origin="mailto:*" launch-external="yes"/>
<allow-intent href="*"/>
<allow-navigation href="*"/>
<allow-navigation href="tel:*"/>
<allow-navigation href="mailto:*"/>
<allow-navigation href="data:*"/>
<plugin name="cordova-plugin-whitelist" version="1" />
And this to index.html:
<meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'">
When I'm clicking to a link like that: Call! nothing happens on the ios (on the android it works well).
If I change my config.xml to:
<access origin="//*"/>
<access origin="tel:*" launch-external="yes"/>
<access origin="mailto:*" launch-external="yes"/>
<allow-intent href="//*"/>
<allow-navigation href="//*"/>
<allow-navigation href="tel:*"/>
<allow-navigation href="mailto:*"/>
<allow-navigation href="data:*"/>
<plugin name="cordova-plugin-whitelist" version="1" />
It calls, but ajax requests to server stop working.

just remove allow-navigation
<allow-navigation href="tel:*"/>
<allow-navigation href="mailto:*"/>
I don't why ,but it work!
cordova-ios#4+wkwebview will get the navigation filter first to respond for the url,and do nothing!!
https://github.com/apache/cordova-plugin-wkwebview-engine/pull/20

Related

Unsupported URL error on ionic 1 (ios devices only)

Unfortunately I needed to do a project with ionic 1. I did the project. It works flawlessly for Android for Web and for iOS Web. But the project file does not work on iOS devices. After passing the Splash Screen, it gives an "unsupported URL" error no matter what page it is. I couldn't solve this problem.
I am getting this error in Xcode log:
Domain=RBSAssertionErrorDomain Code=2 "Specified target process does not exist"
UserInfo={NSLocalizedFailureReason=Specified target process does not exist}
On the device this error:
Failed to load webpage with error: unsupported URL
Index.html:
<meta http-equiv="Content-Security-Policy" content="default-src * 'self' data: gap: 'unsafe-inline' 'unsafe-eval'; style-src * 'self' 'unsafe-inline' 'unsafe-eval' gap:; script-src * 'self' 'unsafe-inline' 'unsafe-eval' gap:; frame-src *;">
config.xml:
<access origin="*" />
<allow-intent href="http:///" />
<allow-intent href="https:///" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<preference name="ScrollEnabled" value="false" />
<preference name="BackupWebStorage" value="none" />
<preference name="SplashMaintainAspectRatio" value="true" />
<preference name="FadeSplashScreenDuration" value="300" />
<preference name="SplashShowOnlyFirstTime" value="false" />
<preference name="SplashScreen" value="screen" />
<preference name="SplashScreenDelay" value="3000" />
<preference name="orientation" value="portrait" />
<allow-navigation href="file:///" />
<allow-navigation href="http:///" />
<allow-navigation href="https:///" />
<allow-navigation href="data:*" />
<allow-navigation href="*" />
<allow-navigation href="http://localhost:8080/*" />
Home Page link:
http://localhost:8100/#/app/firstPage

Getting blank screen in IPA after updating angular cordova-ios platform

Initially we were using angular cordova-ios version as 4.5.4 and while uploading the IPA to Apple Store Connect it gave UIWebView error hence, upgraded the cordova-ios platform to 5.1.1 and added cordova-plugin-wkwebview-engine plugin. Now on generating IPA , it shows blank screen and doesn't route to the login screen.
Version details are as below:
angular-devkit/architect 0.10.7
#angular-devkit/build-angular 0.10.7
#angular-devkit/build-optimizer 0.10.7
#angular-devkit/build-webpack 0.10.7
#angular-devkit/core 7.0.7
#angular-devkit/schematics 0.8.9
#angular/cli 6.2.9
#ngtools/webpack 7.0.7
#schematics/angular 0.8.9
#schematics/update 0.8.9
rxjs 5.5.12
typescript 2.9.2
webpack 4.19.1
cordova-ios 5.1.1
We used the below command to build:
ng build --prod --source-map=false && cordova build ios
Our config.xml file
<?xml version='1.0' encoding='utf-8'?>
<widget android-activityName="appname" android-versionCode="10002" id="appname" version="1.0.2" xmlns="http://www.w3.org/ns/widgets" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>appname</name>
<description>
Description
</description>
<author email="Support#appname.com" href="http://appname.com">
appname
</author>
<content src="index.html" />
<allow-navigation href="*" />
<allow-intent href="*" />
<access origin="*" />
<edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application">
<application android:usesCleartextTraffic="true" />
</edit-config>
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<platform name="android">
<allow-intent href="market:*" />
<icon density="ldpi" src="res/icon/android/ldpi.png" />
<preference name="CustomURLSchemePluginClearsAndroidIntent" value="true" />
</platform>
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
<icon density="ldpi" src="res/icon/android/ldpi.png" />
</platform>
<hook src="hooks/appBeforeBuild.js" type="before_build" />
<hook src="hooks/appBeforeBuild.js" type="before_run" />
<engine name="browser" spec="^5.0.3" />
<plugin name="cordova-plugin-dbcopy" spec="^2.1.2" />
<plugin name="cordova-plugin-whitelist" spec="^1.3.3" />
<plugin name="cordova-plugin-network-information" spec="^2.0.1" />
<plugin name="uk.co.workingedge.cordova.plugin.sqliteporter" spec="^1.1.0" />
<plugin name="cordova-plugin-device" spec="^2.0.2" />
<plugin name="cordova-plugin-printer" spec="^0.7.3" />
<plugin name="cordova-plugin-file-transfer" spec="^1.7.1" />
<plugin name="cordova-plugin-customurlscheme" spec="^4.4.0">
<variable name="URL_SCHEME" value="URL_SCHEME_NAME" />
<variable name="ANDROID_SCHEME" value=" " />
<variable name="ANDROID_HOST" value=" " />
<variable name="ANDROID_PATHPREFIX" value="/" />
</plugin>
<plugin name="cordova-plugin-dialogs" spec="^1.3.3" />
<plugin name="cordova-plugin-bluetoothle" spec="^4.5.10" />
<plugin name="cordova-plugin-bluetooth-peripheral-usage-description" spec="^1.0.1">
<variable name="TEXT" value="Some string" />
</plugin>
<plugin name="cordova-plugin-geolocation" spec="^4.0.2" />
<plugin name="cordova-plugin-android-permissions" spec="^1.0.2" />
<plugin name="cordova-plugin-ble-central" spec="^1.2.5" />
<plugin name="cordova-plugin-inappbrowser" spec="^3.2.0" />
<plugin name="cordova-plugin-permission" spec="^0.1.0" />
<plugin name="cordova-plugin-vibration" spec="^3.1.1" />
</widget>
Unfortunately, white screen errors are pretty generic, as the error condition isn't listed in the console (see Cordova - white screen after splash, no exceptions in console).
You can, however, launch the app in the iOS simulator and hook it up to Safari's dev tools, and then hit refresh. It should kick out the exception that iOS is running into.

Allow-navigation on iOS

I have a cordova app for Android and iOS. The app is a mobile website that loads in the webview. When a user clicks a link, that is outside the mobile website, I want the link opened in the system browser.
Now on Android this works fine with allow-navigation. iOS it's not.
<allow-navigation href="https://mywebsite.nl/*" />
<allow-navigation href="https://code.jquery.com/*" />
<allow-navigation href="https://fonts.googleapis.com/*" />
<allow-navigation href="https://use.fontawesome.com/*" />
<allow-navigation href="*.google.com" />
<allow-navigation href="*.googleapis.com" />
<allow-navigation href="*.gstatic.com" />
<allow-navigation href="*.googleusercontent.com" />
<allow-navigation href="google.com/*" />
<allow-navigation href="googleapis.com/*" />
<allow-navigation href="gstatic.com/*" />
<allow-navigation href="googleusercontent.com/*" />
<preference name="AllowInlineMediaPlayback" value="true" />
<preference name="MediaPlaybackRequiresUserAction" value="false" />
<allow-navigation href="*youtube*" />
<allow-navigation href="*ytimg*" />
<allow-navigation href="*youtube-nocookie*" />
<allow-navigation href="*vimeo*" />
<access origin="https://*.youtube-nocookie.com" />
<access origin="https://*.youtube.com" />
<access origin="*.vimeo.com" />
<access origin="*.vimeocdn.com" />
<access origin="https://*.ytimg.com" />
<access origin="https://*.gstatic.com" />
<access origin="https://*.googlevideo.com" />
<access origin="https://*.google.com" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
Do I need to add something for iOS to open the system browser when clicking an external link?

phonegap app no network connection on Android 9 Pie

I have a phonegap app that is working on every Android Version except 9 Pie.
Navigating to a website works. That means my allow-navigation tags must be correct.
But sending a XMLHttpRequest I get no data.
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function(){
if(xmlhttp.readyState==4){
if(xmlhttp.status==200){
var info = xmlhttp.responseXML;
if(info!=null){
//doLog(xmlhttp.responseText);
...
}
} else {
doLog("Server answer: " + xmlhttp.status + " " + xmlhttp.statusText);
}
}
}
xmlhttp.open("GET", serverURL + url, true);
xmlhttp.send();
I read you need minSdkVersion of 17 for apps to work with android 9. Mine has 19 already. TargetSdkVersion is 28.
Of course I use whitelist plugin.
<preference name="phonegap-version" value="cli-8.2.2" />
<preference name="keepRunning" value="true" />
<preference name="android-minSdkVersion" value="19" />
<preference name="android-targetSdkVersion" value="28" />
<preference name="android-build-tool" value="gradle" />
<access launch-external="yes" origin="geo:*" />
<access launch-external="yes" origin="mailto:*" />
<access launch-external="yes" origin="http://*" />
<access launch-external="yes" origin="https://*" />
<access origin="*" />
<allow-navigation href="http://*/*" />
<allow-navigation href="https://*/*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
Anyone an idea?
Problem vanished.
What I changed before this release build:
Added
<preference name="phonegap-version" value="cli-8.2.2" />
Reinstalled whitelist plugin.

Cordova ionic can't connect to to any internet services

I've been building an app with cordova and ionic using angular js. When I complile the project to android everything works fine, but with iOS I can't connect to anything.
I'm trying to log in to firebase database, as well as exchange some HTTP requests. again, all works fine on android.
Here's my config.xml:
<?xml version='1.0' encoding='utf-8'?>
<widget id="private.private.private" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>Puurs 725</name>
<description>An awesome Ionic/Cordova app.</description>
<author email="hi#ionicframework" href="http://ionicframework.com/">Ionic Framework Team</author>
<content src="index.html" />
<access origin="*" />
<allow-navigation href="http://ionic.local/*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<allow-navigation href="*://*youtube.com" />
<allow-navigation href="*" />
<platform name="android">
<allow-intent href="market:*" />
</platform>
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
</platform>
<preference name="webviewbounce" value="false" />
<preference name="UIWebViewBounce" value="false" />
<preference name="DisallowOverscroll" value="true" />
<preference name="android-minSdkVersion" value="16" />
<preference name="BackupWebStorage" value="none" />
<preference name="SplashMaintainAspectRatio" value="true" />
<preference name="FadeSplashScreenDuration" value="300" />
<preference name="SplashShowOnlyFirstTime" value="false" />
<feature name="StatusBar">
<param name="ios-package" onload="true" value="CDVStatusBar" />
</feature>
<plugin name="ionic-plugin-keyboard" spec="~2.2.1" />
<plugin name="cordova-plugin-whitelist" spec="1.3.1" />
<plugin name="cordova-plugin-console" spec="1.0.5" />
<plugin name="cordova-plugin-statusbar" spec="2.2.1" />
<plugin name="cordova-plugin-device" spec="1.1.4" />
<plugin name="cordova-plugin-splashscreen" spec="~4.0.1" />
<plugin name="NetworkStatus" value="CDVConnection" />
<plugin name="cordova-plugin-googleplus" spec="~5.1.1">
<variable name="REVERSED_CLIENT_ID" value="com.googleusercontent.apps.lotsofprivatenumbers" />
</plugin>
</widget>
Fun thing is that this was supposed to be working. But I accidently overwrote my index.html file. In there meta data for my index I have:
<meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'">
Rings a bell to anyone?
Well, I learned how to hook up my ipad running the app to my mac, debugged the safari console (this feature is awesome) and found out a javascript error was blocking further executions.
More specific, Object.values is not supported on safari.

Resources