【问题标题】:Ionic whitelist plugin blocks the iPhone but works in the browser离子白名单插件阻止 iPhone 但在浏览器中工作
【发布时间】:2015-12-10 12:04:40
【问题描述】:

我有一个与后端通信的 ionic 移动应用。它运行一个简单的登录,在 android(浏览器/手机)和 mac(只是浏览器)中完美运行。在 iPhone 上运行时返回失败:

 MyAppName[931:60b] ERROR whitelist rejection:

 url='https://login.myurlapi.com/apitest/validate.php'

我检查了白名单插件文档,应该可以找到添加到我的config.xml 中的配置:

<access origin="myapiurl.com"/>
  <allow-navigation href="https://*/*"/>
  <allow-intent href="https://*/*"/>
  <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="SplashScreen" value="screen"/>
  <preference name="SplashScreenDelay" value="3000"/>
  <feature name="StatusBar">
    <param name="ios-package" onload="true" value="CDVStatusBar"/>
  </feature>
  <platform name="ios">
    <access origin="myapiurl.com"/>
  </platform>

更新:我检查了日志,看起来甚至无法从以下位置获取默认的 ionic 样式级联表:

 ERROR whitelist rejection:
 url='http://code.ionicframework.com/ionicons/1.5.2/css/ionicons.min.css'

【问题讨论】:

  • 试试这个:在 orgin="" 中使用 http 或 https : myapiurl.com">
  • @cfprabhu 这没什么区别,但还是谢谢

标签: android ios ionic-framework


【解决方案1】:

这是用于修复 iOS 中的连接问题并使其在 android 中正常工作的配置,看看我如何在每个平台中使用配置而不是使用全局参数:

  <content src="index.html"/>
  ...
  <preference name="SplashScreen" value="screen"/>
  <preference name="SplashScreenDelay" value="2000"/>
  <feature name="StatusBar">
    <param name="ios-package" onload="true" value="CDVStatusBar"/>
  </feature>
  <platform name="ios">
    <access origin="myapiurl.com"/>
    <icon src="resources/ios/icon/icon.png" width="57" height="57"/>
    <icon src="resources/ios/icon/icon@2x.png" width="114" height="114"/>
    ... 
  </platform>
  <platform name="android">
    <access origin="myapiurl.com"/>
    <allow-navigation href="https://*/*"/>
    <allow-intent href="https://*/*"/>
    <icon src="resources\android\icon\drawable-ldpi-icon.png" density="ldpi"/>
    ...
  </platform>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-06-28
    • 2017-10-25
    • 2014-11-17
    • 2015-05-30
    • 2015-01-07
    • 1970-01-01
    相关资源
    最近更新 更多