Ionic View 应用程序未检索数据

Ionic View app not retrieving data

我正忙于测试我的应用程序,目前它在我的浏览器中可以运行,但在 离子视图 (IOS) 应用程序中它不能。

应用本身的问题是它没有加载任何数据。

My setup is like this - WCF RESTful <-> IIS <-> app.

所以正如我提到的,它在我的浏览器中工作,这意味着 IIS 和我的服务工作正常。但是现在不知道是Ionic View app,IOS还是别的?

我的第一个猜测是您的请求中存在 404 错误问题。

If you're using a newer version of Cordova (or the latest Ionic CLI) to develop your app, you may be experiencing http 404 errors when your app tries to make network requests.

这可以通过 Cordova Whitelist plugin 快速解决。

您可以在 Ionic docs: Cordova Whitelist 上找到更多文档。

解法:

运行 在您的 shell/terminal 中执行以下命令:

ionic plugin add https://github.com/apache/cordova-plugin-whitelist.git

您现在唯一需要做的就是将 属性 添加到您的 config.xml 文件:

<access origin="http://google.com" />

这应该放在 config.xml 文件中的什么位置?(简化的 config.xml 示例)

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<widget id="com.ionicframework.myApp" version="1.0.0">
    <name>myApp</name>
    <content src="index.html"/>
    <!-- Allows access to maps.google.com and docs.google.com -->
    <access origin="http://google.com" subdomains="true" />
    <access origin="https://fonts.googleapis.com"/>
</widget>