Weinre 是否可以在调试 iOS webview 时设置 javascript 断点
我正在使用 weinre 来调试phonegap应用程序。然而,似乎不可能单步执行 JS 或设置断点。这有可能吗?
I'm using weinre to debug a phonegap application. However it doesn't seem possible to step through the JS or set breakpoints. Is this at all possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
不,不可能用 weinre 设置断点。
No, it is not possible to set breakpoints with weinre.
正确答案是否定的。另一个答案中提到的“秘密 XCode UIWebView”不再起作用。但是...
您现在可以将 Weinre 扔到窗外,因为随着 iOS 6 的发布,Apple 发布了适用于 Safari 的远程移动 Web Inspector,这对于任何一直在努力调试 iOS 移动应用程序的人来说都是巨大的。基本上,您拥有适用于您的移动应用程序(包括 WebView 和 WebView)的常规 Safari Web Inspector 的所有功能和功能(包括断点)。电话间隙应用程序。我经常使用 weinre,这使得它对于这些目的来说完全过时了,因为新的远程 Web Inspector 是一个功能齐全的本机调试器。
它的工作原理如下(需要 Mac、运行 iOS 6 模拟器(或者我认为是附加的 iOS 6 设备)的 xCode 4.5+,以及 Mac 上的 Safari 6+:
在你的 ios6 模拟器/设备中,设置 --> Safari --> 高级 --> Web 检查器 --> 打开(在 Safari 中默认为打开),
从“开发”菜单访问 iPhone/iPad 模拟器并查看您的页面。如果您没有看到 Safari 高级首选项中的“开发”菜单,请参阅
底部的更多讨论:http://www.mobilexweb.com/blog/iphone-5-ios-6-html5-developers
No is the correct answer. And the "secret XCode UIWebView" mentioned in the other answer doesn't work any more. BUT ...
You can now throw the Weinre out the window because, with the release of iOS 6, Apple released remote mobile Web Inspector for Safari, and this is HUGE for anyone who's been struggling to debug their iOS mobile apps. Basically you have all the features and power of regular Safari Web Inspector--including Breakpoints--for your mobile apps, including WebView & Phonegap apps. I've used weinre quite a bit, and this makes it completely obsolete for these purposes, since the new remote Web Inspector is a full-featured, native debugger.
Here's how it works (requires a Mac, xCode 4.5+ running an iOS 6 simulator (or an attached iOS 6 device, I think), and Safari 6+ on your Mac:
In your ios6 simulator/device, Settings --> Safari --> Advanced --> Web Inspector --> On (this is On by default in the simulator).
In Safari, access iPhone/iPad Simulator from the Develop menu and see your page. You can enable the Develop menu in Safari's Advanced Preferences if you don't see it.
More discussion at the bottom of: http://www.mobilexweb.com/blog/iphone-5-ios-6-html5-developers
即使这是一个老问题,也许有人仍在努力从 Windows 进行 iOS 调试(就像我直到今天一样......:D)。
我发现这个非常好的解决方案:
https://www.genuitec.com/products/gapdebug/
您可以从 ipa 安装应用程序并调试所有通常被 Safari 混淆的代码。
even if this an old question, maybe someone is still struggling with iOS debugging from windows (as i was until today...:D).
I found this quite good solution:
https://www.genuitec.com/products/gapdebug/
You can install apps from ipa and debug all the code usually obfuscated by Safari.