简体   繁体   English

离子电容器 IOS 仅适用于 Livereload

[英]Ionic Capacitor IOS Only Works With Livereload

In my ionic capacitor ios app, the app works just fine on a web browser using ionic serve .在我的离子电容器 ios 应用程序中,该应用程序在使用ionic serve的 web 浏览器上运行良好。 When I try running ionic capacitor run ios , that is successful but when I build the app I get this:当我尝试运行ionic capacitor run ios时,这是成功的,但是当我构建应用程序时,我得到了这个:

控制台不工作

While that looks like a lot, you can see that at the end it says Webview failed to load and the request timed out.虽然这看起来很多,但您可以看到最后它说 Webview 加载失败并且请求超时。 On my phone, all I see is the splash screen.在我的手机上,我只看到启动画面。

Instead, when I run ionic cap run ios -l --external , I get this:相反,当我运行ionic cap run ios -l --external时,我得到了这个:

使用 livereload 的工作控制台

In this console, the same warning messages happen, but it says "onscript loading complete" and then the actual app works.在此控制台中,会出现相同的警告消息,但它会显示“onscript loading complete”,然后实际应用程序会运行。

I have looked through many StackOverflow + github pages offering help for this issue.我浏览了许多 StackOverflow + github 页面,为这个问题提供帮助。 From this issue , I made sure that my phone and computer were on the same wifi.从这个问题开始,我确保我的手机和电脑在同一个wifi上。 Anyone experienced this error before/knows what to do?之前有人遇到过这个错误/知道该怎么做吗? This code has worked in the past.此代码在过去有效。

I figured out the issue.我想通了这个问题。 The app was trying to connect to a server that did not exist.该应用程序试图连接到不存在的服务器。 I needed to remove the server field in capacitor.config.json .我需要删除capacitor.config.json中的server字段。 I cut out that json field and then ran ionic cap run ios , and the code worked.我剪掉了 json 字段,然后运行ionic cap run ios ,代码运行了。

Please comment if you are still experiencing this issue如果您仍然遇到此问题,请发表评论

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM