react-native sentry 简单接入

378 阅读1分钟

sentry基本开发

1、sentry.io登录sentry,创建一个项目。

2、添加@sentry/react-native依赖项:

npm install --save @sentry/react-native

3、如果你运行的是react-native0.60 之前的项目,你仍然需要调用react-native link,否则你可以跳过这一步,react-native0.60 及以上版本会自动执行此操作。

react-native link @sentry/react-native

4、npx @sentry/wizard -i reactNative -p ios android 会在目录生成sentry.properties文件

image.png

image.png

url:sentry 域名地址 ,主要上传sourceMap文件地址 project: 项目名称 org: 组织名称 这里注意,不是侧边菜单栏的大写组织名,一般小写 token:sentry生成的auth token

5、初始化SDK

image.png

6、异常上报

image.png

image.png