简体   繁体   English

从 Capacitor 获取 IOS 控制台

[英]Getting IOS console from Capacitor

Does anyone know how to view console.log() from the Xcode simulator using capacitor?有谁知道如何使用电容器从 Xcode 模拟器查看console.log() I am aware that you can view the system logs via iOS Simulator > Menu Bar > Debug > Open System Log ( How can I get the console logs from the iOS Simulator? ), but this does not show any of the console.logs when using capacitor to run an ios application.我知道您可以通过 iOS Simulator > Menu Bar > Debug > Open System Log 查看系统日志( 如何从 iOS Simulator 获取控制台日志? ),但这在使用时不显示任何 console.logs电容器运行 ios 应用程序。

I couldn't get the Ionic instructions to give any output via Safari's dev tools.我无法通过 Safari 的开发工具获得 Ionic 指令以提供任何 output。

However, Capacitor's solution is its built-in Console API https://capacitorjs.com/docs/v2/apis/console然而,Capacitor的解决方案是其内置的Console API https://capacitorjs.com/docs/v2/apis/console

The Console API automatically sends console.debug, console.error, console.info, console.log, console.trace and console.warn calls to the native log system on each respective platform.控制台 API 自动将 console.debug、console.error、console.info、console.log、console.trace 和 console.warn 调用发送到每个相应平台上的本机日志系统。 This enables, for example, console.log calls to be rendered in the Xcode and Android Studio log windows.例如,这可以在 Xcode 和 Android Studio 日志 windows 中呈现 console.log 调用。

I was able to see the logs in Xcode's logging as long as the build isnt broken in some way.只要构建没有以某种方式被破坏,我就能够在 Xcode 的日志记录中看到日志。

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

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