Ionic app适用于Android,但不适用于IOS

时间:2021-03-30 18:24:10

I've been building an Ionic app (my first one) and for the life of me I can't figure out why it works on android but not iOS. I'm able to build both with no errors. The app works just as it should in android 6.0.1 but it doesn't work in any version of iOS.

我一直在构建一个Ionic应用程序(我的第一个),对于我的生活,我无法弄清楚为什么它适用于Android但不适用于iOS。我能够在没有错误的情况下构建它们。该应用程序的工作方式与Android 6.0.1中的应用程序一样,但它不适用于任何版本的iOS。

The iOS version of the app loads, but none of the views show up. Ionic app适用于Android,但不适用于IOS

iOS版本的应用程序加载,但没有任何视图显示。

The Android version: Ionic app适用于Android,但不适用于IOS

Android版本:

Here are some details:
- Cordova 6.0.0
- Ionic 1.7.14
- Android 6.0.1
- iOS isn't working in any version of iOS and the results are the same in the simulator as well as on device.
- XCode doesn't have any errors when compiling but lots of warnings (I think that has to do with the Cordova components.)
- Cordova Installed platforms: android 5.1.0, ios 4.0.1

以下是一些细节: - Cordova 6.0.0 - Ionic 1.7.14 - Android 6.0.1 - iOS无法在任何版本的iOS中运行,结果在模拟器和设备上都相同。 - 编译时XCode没有任何错误,但有很多警告(我认为这与Cordova组件有关。) - Cordova安装平台:android 5.1.0,ios 4.0.1

Again the app runs perfectly on android. The iOS version opens but none of my views show up. The app framework seems to work (like the menu button, etc). I suspect a iOS angular compile issue but I'm not sure what to do.

该应用程序再次在Android上运行完美。 iOS版本打开但我的视图都没有出现。应用程序框架似乎工作(如菜单按钮等)。我怀疑iOS角度编译问题,但我不知道该怎么做。

Update 1 After following the suggestion below I enabled debugging in Safari and now I get the following:

更新1按照下面的建议后,我在Safari中启用了调试,现在我得到以下内容:

XMLHttpRequest cannot load file:///var/mobile/Containers/Bundle/Application/E3199C94-4C7E-426C-940D-94A1357A8CDE/SKOApp.app/www/feeds-categories.json. Cross origin requests are only supported for HTTP.

What's particularly interesting is, I don't get a similar CORS error on my local machine nor in android.

特别有趣的是,我在本地机器上和android中都没有类似的CORS错误。

2 个解决方案

#1


1  

If you have node set up. You can try using http-server.

如果您设置了节点。您可以尝试使用http-server。

npm install http-server -g

npm安装http-server -g

FYI: https://github.com/indexzero/http-server

仅供参考:https://github.com/indexzero/http-server

#2


1  

You can try THIS regarding CORS error with Ionic.

您可以尝试使用Ionic处理CORS错误。

#1


1  

If you have node set up. You can try using http-server.

如果您设置了节点。您可以尝试使用http-server。

npm install http-server -g

npm安装http-server -g

FYI: https://github.com/indexzero/http-server

仅供参考:https://github.com/indexzero/http-server

#2


1  

You can try THIS regarding CORS error with Ionic.

您可以尝试使用Ionic处理CORS错误。