也许我误解了目的。我正在寻找一种解决方案来替换我的应用程序中的 console.log(errors),因为我已准备好进行生产。我完成了将 Sentry 功能添加到我的 expo 托管工作流程项目中的步骤。它似乎工作,它连接,它运行 Sentry.init() 很好。但是,当我尝试使用 Sentry.captureException('some exception') 代替 console.log 时,应用程序崩溃,并且我得到“Sentry.captureException 不是函数”。它在我的哨兵控制台中记录了该错误。所以错误正在传递到我的哨兵项目。但从我关注的文档来看,Sentry.captureException 应该是一个有效的函数?我缺少什么?我也尝试过 Sentry.captureMessage ,结果相同。
应用程序.js
import * as Sentry from 'sentry-expo';
Sentry.init({
dsn: 'xxxx',
enableInExpoDevelopment: true,
debug: true, // Sentry will try to print out useful debugging information if something goes wrong with sending an event. Set this to `false` in production.
});
enableScreens();
export default function App() {
return (
<NavigationContainer>
<AuthNavigator />
</NavigationContainer>
)
}
Run Code Online (Sandbox Code Playgroud)
app.json 博览会挂钩
"hooks": {
"postPublish": [
{
"file": "sentry-expo/upload-sourcemaps",
"config": …Run Code Online (Sandbox Code Playgroud)