英文:
Ionic app - Cordova - Safari Debug not working
问题
过去,我可以将我的Ionic Cordova应用程序运行到我的iPhone上,然后将其连接到我的Mac,然后在Mac上打开Safari,转到开发 -> PHONE_NAME -> localhost 来检查我的应用程序。
但是,当前当我进入开发菜单时,PHONE_NAME会显示,但是应用程序不会显示为选项。
如果我在手机上打开Safari,它会显示为一个选项,所以我知道它可以工作,只是对于我的Ionic应用程序不起作用。
我看到cordova-ios 6.3.0提到他们修复了这个问题:
> 这个版本包含一个修复,允许检查最新的iOS和Xcode版本中的WebView内容。它还修复了一个iOS 16的错误和与NodeJS 18相关的问题。
> 引用
https://cordova.apache.org/announcements/2023/04/15/cordova-ios-release-6.3.0.html
但是,在更新到cordova-ios 6.3.0之后,问题仍然存在。
有什么其他尝试的想法吗?
Mac OS版本:Ventura 13.4
iPhone iOS版本:16.5
xCode版本:14.3.1
英文:
In the past I was able to run my Ionic Cordova app onto my iPhone and plug it into my Mac, then open Safari on my Mac and go to Develop -> PHONE_NAME -> localhost to inspect my app.
Currently when I go to the Develop menu, PHONE_NAME shows up however, the app does not show up as an option.
If I open Safari on my phone it shows up as an option so I know it works, just not with my Ionic app.
I saw that cordova-ios 6.3.0 mentions they fixed a bug with this:
> This release contains a fix to allow inspecting of WebView content with the
> latest iOS and Xcode versions. It also fixes an iOS 16 bug and issues
> with NodeJS 18.
> Blockquote
https://cordova.apache.org/announcements/2023/04/15/cordova-ios-release-6.3.0.html
But after updating to cordova-ios 6.3.0 the problem persists.
Any ideas what else to try?
Mac OS Version: Ventura 13.4
iPhone iOS Version: 16.5
xCode Version: 14.3.1
答案1
得分: 2
经过进一步调查,似乎在 cordova-ios 上已经修复了这个问题,但 Ionic 使用了自己的 WebKit。
因此,修复应该应用于 Ionic 的插件:
https://github.com/ionic-team/cordova-plugin-ionic-webview
我发现该插件上已经有一个包含修复的拉取请求:
https://github.com/ionic-team/cordova-plugin-ionic-webview/pull/677
我通过分叉主分支、应用更改,然后更新我的 package.json 来在本地使检查工作正常,如下所示:
"cordova-plugin-ionic-webview": "github:<你的Github用户名>/cordova-plugin-ionic-webview"
英文:
After looking into this more, it seems the problem has been fixed on cordova-ios, however ionic uses it's own webkit.
So the fix would have to be applied to Ionic's plugin:
https://github.com/ionic-team/cordova-plugin-ionic-webview
I found there is already a pull request on that plugin with the fix:
https://github.com/ionic-team/cordova-plugin-ionic-webview/pull/677
I was able to get the inspect working for me locally by forking the master branch, applying the changes then updating my package.json like so:
"cordova-plugin-ionic-webview": "github:< YourGithubUsername >/cordova-plugin-ionic-webview"
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论