【发布时间】:2015-10-09 09:15:33
【问题描述】:
我正在尝试在 iOS 上使用 Cordova InAppBrowser,但它似乎不起作用。
我找到了一些可能的解决方案:https://goo.gl/G7GfGghttp://goo.gl/sYXfRg
有些需要手动修改文件,但我使用的是Phonegap Build,所以我无法修改插件,还有一些关于config.xml的说明,所以这是我当前的配置:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<widget id="au.gov.nal.hearing.myhearing" version="0.10.3" versionCode="624" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:gap="http://phonegap.com/ns/1.0">
<gap:platform name="ios"/>
<gap:platform name="android"/>
<preference name='phonegap-version' value='cli-5.2.0' />
<name>My Hearing</name>
<description>My Hearing App</description>
<author email="rene@bywave.com.au" href="http://bywave.com.au/">Renemari Padillo</author>
<content src="index.html"/>
<preference name="AutoHideSplashScreen" value="true"/>
<preference name="SplashScreenDelay" value="5000"/>
<preference name="ShowSplashScreenSpinner" value="false"/>
<preference name="FadeSplashScreen" value="true"/>
<preference name="FadeSplashScreenDuration" value="1.0"/>
<preference name="SplashScreen" value="screen"/>
<preference name="detect-data-types" value="true"/>
<preference name="target-device" value="handset"/>
<access origin="*"/>
<access origin="*.google.com"/>
<access origin="*.parse.com"/>
<access origin="*.googleapis.com"/>
<access origin="*.gstatic.com"/>
<access origin="*.googleusercontent.com"/>
<access origin="google.com" subdomains="true"/>
<access origin="googleapis.com" subdomains="true"/>
<access origin="gstatic.com" subdomains="true"/>
<access origin="googleusercontent.com" subdomains="true"/>
<access origin="parse.com" subdomains="true"/>
<access origin="tel:*" launch-external="yes"/>
<allow-navigation href="*"/>
<allow-intent href="tel:*" launch-external="yes"/>
<allow-intent href="*" launch-external="yes"/>
<gap:plugin name="cordova-plugin-x-socialsharing" source="npm" version="5.0.4"/>
<gap:plugin name="com.ionic.keyboard" version="1.0.3"/>
<gap:plugin name="uk.co.whiteoctober.cordova.appversion" version="0.1.4"/>
<gap:plugin name="org.apache.cordova.splashscreen" version="0.3.4"/>
<gap:plugin name="cordova-plugin-inappbrowser" source="npm" version="1.0.1"/>
<gap:plugin name="cordova-plugin-whitelist" source="npm" version="1.0.0"/>
<gap:plugin name="org.apache.cordova.core.geolocation" version="0.3.10"/>
<gap:plugin name="com.medlei.pushplugin" version="0.1.2">
<param name="APP_ID" value="Bd8dbfMRwToBaB8UP0SWZ0ZlgYJ2o1CqMtFqzkuh"/>
<param name="CLIENT_KEY" value="0ev2Je3JX3ln5XJHTsFTbJwNpG7k5eXpt5l83CVs"/>
</gap:plugin>
<icon src="resources/icon.png"/>
<icon gap:platform="android" src="resources/android/icon/drawable-ldpi-icon.png" gap:density="ldpi"/>
<icon gap:platform="android" src="resources/android/icon/drawable-mdpi-icon.png" gap:density="mdpi"/>
<icon gap:platform="android" src="resources/android/icon/drawable-hdpi-icon.png" gap:density="hdpi"/>
<icon gap:platform="android" src="resources/android/icon/drawable-xhdpi-icon.png" gap:density="xhdpi"/>
<icon gap:platform="android" src="resources/android/icon/drawable-xxhdpi-icon.png" gap:density="xxhdpi"/>
<icon gap:platform="android" src="resources/android/icon/drawable-xxxhdpi-icon.png" gap:density="xxxhdpi"/>
<icon gap:platform="ios" src="resources/ios/icon/icon.png" width="57" height="57"/>
<icon gap:platform="ios" src="resources/ios/icon/icon@2x.png" width="114" height="114"/>
<icon gap:platform="ios" src="resources/ios/icon/icon-40.png" width="40" height="40"/>
<icon gap:platform="ios" src="resources/ios/icon/icon-40@2x.png" width="80" height="80"/>
<icon gap:platform="ios" src="resources/ios/icon/icon-50.png" width="50" height="50"/>
<icon gap:platform="ios" src="resources/ios/icon/icon-50@2x.png" width="100" height="100"/>
<icon gap:platform="ios" src="resources/ios/icon/icon-60.png" width="60" height="60"/>
<icon gap:platform="ios" src="resources/ios/icon/icon-60@2x.png" width="120" height="120"/>
<icon gap:platform="ios" src="resources/ios/icon/icon-60@3x.png" width="180" height="180"/>
<icon gap:platform="ios" src="resources/ios/icon/icon-72.png" width="72" height="72"/>
<icon gap:platform="ios" src="resources/ios/icon/icon-72@2x.png" width="144" height="144"/>
<icon gap:platform="ios" src="resources/ios/icon/icon-76.png" width="76" height="76"/>
<icon gap:platform="ios" src="resources/ios/icon/icon-76@2x.png" width="152" height="152"/>
<icon gap:platform="ios" src="resources/ios/icon/icon-small.png" width="29" height="29"/>
<icon gap:platform="ios" src="resources/ios/icon/icon-small@2x.png" width="58" height="58"/>
<icon gap:platform="ios" src="resources/ios/icon/icon-small@3x.png" width="87" height="87"/>
<gap:splash src="resources/splash.png"/>
<gap:splash gap:platform="android" src="resources/android/splash/drawable-land-ldpi-screen.png" gap:qualifier="land-ldpi"/>
<gap:splash gap:platform="android" src="resources/android/splash/drawable-land-mdpi-screen.png" gap:qualifier="land-mdpi"/>
<gap:splash gap:platform="android" src="resources/android/splash/drawable-land-hdpi-screen.png" gap:qualifier="land-hdpi"/>
<gap:splash gap:platform="android" src="resources/android/splash/drawable-land-xhdpi-screen.png" gap:qualifier="land-xhdpi"/>
<gap:splash gap:platform="android" src="resources/android/splash/drawable-land-xxhdpi-screen.png" gap:qualifier="land-xxhdpi"/>
<gap:splash gap:platform="android" src="resources/android/splash/drawable-land-xxxhdpi-screen.png" gap:qualifier="land-xxxhdpi"/>
<gap:splash gap:platform="android" src="resources/android/splash/drawable-port-ldpi-screen.png" gap:qualifier="port-ldpi"/>
<gap:splash gap:platform="android" src="resources/android/splash/drawable-port-mdpi-screen.png" gap:qualifier="port-mdpi"/>
<gap:splash gap:platform="android" src="resources/android/splash/drawable-port-hdpi-screen.png" gap:qualifier="port-hdpi"/>
<gap:splash gap:platform="android" src="resources/android/splash/drawable-port-xhdpi-screen.png" gap:qualifier="port-xhdpi"/>
<gap:splash gap:platform="android" src="resources/android/splash/drawable-port-xxhdpi-screen.png" gap:qualifier="port-xxhdpi"/>
<gap:splash gap:platform="android" src="resources/android/splash/drawable-port-xxxhdpi-screen.png" gap:qualifier="port-xxxhdpi"/>
<gap:splash gap:platform="ios" src="resources/ios/splash/Default-568h@2x~iphone.png" height="1136" width="640"/>
<gap:splash gap:platform="ios" src="resources/ios/splash/Default-667h@2x.png" height="1334" width="750"/>
<gap:splash gap:platform="ios" src="resources/ios/splash/Default-736h.png" height="2208" width="1242"/>
<gap:splash gap:platform="ios" src="resources/ios/splash/Default-Landscape-736h.png" height="1242" width="2208"/>
<gap:splash gap:platform="ios" src="resources/ios/splash/Default-Portrait-736h@3x.png" width="1242" height="2208"/>
<gap:splash gap:platform="ios" src="resources/ios/splash/Default-Landscape-736h@3x.png" width="2208" height="1242"/>
<gap:splash gap:platform="ios" src="resources/ios/splash/Default-Landscape@2x~ipad.png" height="1536" width="2048"/>
<gap:splash gap:platform="ios" src="resources/ios/splash/Default-Landscape~ipad.png" height="768" width="1024"/>
<gap:splash gap:platform="ios" src="resources/ios/splash/Default-Portrait@2x~ipad.png" height="2048" width="1536"/>
<gap:splash gap:platform="ios" src="resources/ios/splash/Default-Portrait~ipad.png" height="1024" width="768"/>
<gap:splash gap:platform="ios" src="resources/ios/splash/Default@2x~iphone.png" height="960" width="640"/>
<gap:splash gap:platform="ios" src="resources/ios/splash/Default~iphone.png" height="480" width="320"/>
</widget>
因此,为了确保这一点,我还将该插件与 ngCordova's InAppBrowser 配对
$cordovaInAppBrowser.open('tel:' + vm.phone, '_system');
index.html
<!-- Enable all requests, inline styles, and eval() -->
<meta http-equiv="Content-Security-Policy" content="default-src *; script-src 'self' 'unsafe-inline' 'unsafe-eval' *; style-src 'self' 'unsafe-inline' *">
该应用没有产生任何错误,通话链接在 Android 上运行良好,但在 iOS 上却不行。
有人对此有解决方案吗?
如果您需要更多技术细节,请告诉我。
谢谢
【问题讨论】:
-
在 iOS 上,它只是在实际窗口中打开还是单击按钮什么也不做?你如何构建你的项目?例如,您是否压缩了
www文件夹,然后使用 build.phonegap 生成 iPhone 文件? -
按钮什么也不做。为了构建应用程序,我只是将 Ionic 项目推送到 Git(包括默认的 .gitignore)。据我所知,Phonegap Build 只需要您的 config.xml 文件,当然还有一些默认文件/文件夹,例如
www,然后我只是简单地将 XML 命名空间更改为 Phonegap,这样它就可以满足它自己的配置语法,例如作为gap:plugin
标签: cordova ionic-framework ionic phonegap-build inappbrowser