Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
任何人都可以帮助我在 xcode 控制台上捕获 JS 日志消息,JS 必须在 Web 视图(UIWebView)上运行。
要从一个 webview 接收消息,请使用自定义 url 方案,就像“log:yourlogmsg”一样
js代码
window.location = "log:yourlogmsg";
利用
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
并返回假;