@@ -15,133 +15,88 @@ We would love to get your feedback!
1515Installation
1616------------
1717
18- Start with adding sentry and linking it::
18+ Start with adding Sentry and linking it::
1919
2020 $ npm install react-native-sentry --save
2121 $ react-native link react-native-sentry
2222
23- The `link ` step will pull in the native dependency. If you are using
24- expo you don't have to (or can't) run that step. In that case we fall
25- back automatically.
23+ The `link ` step will pull in the native dependency and patch your project
24+ accordingly. If you are using expo you don't have to (or can't) run that
25+ step. For more information about that see :doc: `expo `.
26+
27+ On linking you will automatically be prompted for your DSN and other
28+ information and we will configure your app automatically for react-native
29+ and change files accordingly. You will need to provide the following
30+ data: your DSN, the slug of your organization in Sentry, the slug of your
31+ project in Sentry as well as the API key.
32+
33+ You can find the slugs in the URL of your project
34+ (``sentry.io/your-org-slug/your-project-slug ``) If you don't have an auth
35+ token yet you can `create an auth token here <https://sentry.io/api/ >`_.
2636
27- On linking you will usually be prompted for your DSN and we will configure
28- your app automatically for react-native and change files accordingly.
2937Upon linking the following changes will be performed:
3038
31- * added the raven-java package for native crash reporting on android
32- * added the sentry-swift package for native crash reporting on iOS
33- * enabled the sentry gradle build step for android
39+ * add the raven-java package for native crash reporting on Android
40+ * add the sentry-swift package for native crash reporting on iOS
41+ * enable the sentry gradle build step for android
3442* patch `AppDelegate.m ` for iOS
3543* patch `MainApplication.java ` for Android
36- * configured Sentry for the supplied DSN in your `index.js ` files
44+ * configure Sentry for the supplied DSN in your `index.js ` files
45+ * store build credentials in `ios/sentry.properties ` and
46+ `android/sentry.properties `.
3747
3848Note that we only support ``react-native >= 0.38 `` at the moment.
3949
40- iOS Specifics
41- -------------
50+ To see what is happening during linking you can refer to
51+ :doc: ` manual-setup ` which will give you the details.
4252
43- Since we use our `Swift Client
44- <https://github.com/getsentry/sentry-swift> `_ in the background, your
45- project has to embed the swift standard libraries.
53+ Upgrading
54+ ---------
4655
47- Search for ``ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES `` in your Xcode project
48- build settings and set it to ``YES ``.
56+ If you are upgrading from an earlier version of sentry-react-native you
57+ should re-link the package to ensure the generated code is updated to the
58+ latest version::
4959
50- You will get this error message if you forget to set it::
60+ $ react-native unlink react-native-sentry
61+ $ react-native link react-native-sentry
5162
52- dyld: Library not loaded: @rpath/libswiftCore.dylib
53- Referenced from: [Redacted]/Sentry.framework/Sentry
54- Reason: image not found
63+ iOS Specifics
64+ -------------
5565
56- Also note that if you build the project without setting this, you have to
57- run clean in order to make the change work.
66+ Since we use our `Swift Client
67+ <https://github.com/getsentry/sentry-swift> `_ in the background, your
68+ project has to embed the swift standard libraries. The link step will do
69+ this automatically for your project.
5870
5971When you use xcode you can hook directly into the build process to upload
60- debug symbols. Open up your xcode project in the iOS folder, go to your
61- project's target and change the "Bundle React Native code and images"
62- build script. The script that is currently there needs to be adjusted as
63- follows::
64-
65- export SENTRY_ORG=___ORG_NAME___
66- export SENTRY_PROJECT=___PROJECT_NAME___
67- export SENTRY_AUTH_TOKEN=YOUR_AUTH_TOKEN
68- export NODE_BINARY=node
69- ../node_modules/react-native-sentry/bin/bundle-frameworks
70- ../node_modules/sentry-cli-binary/bin/sentry-cli react-native-xcode \
71- ../node_modules/react-native/packager/react-native-xcode.sh
72- ../node_modules/sentry-cli-binary/bin/sentry-cli upload-dsym
73-
74- You can find the slugs in the URL of your project
75- (sentry.io/your-org-slug/your-project-slug) If you don't have an auth
76- token yet you can `create an auth token here <https://sentry.io/api/ >`_.
77-
78- This also uploads debug symbols in the last line which however will not
79- work for bitcode enabled builds. If you are using bitcode you need to
80- remove that line (``../node_modules/sentry-cli-binary/bin/sentry-cli
81- upload-dsym ``) and consult the documentation on dsym handling instead (see
82- :ref: `dsym-with-bitcode `).
83-
84- Note that uploading of debug simulator builds by default is disabled for
85- speed reasons. If you do want to also generate debug symbols for debug
86- builds you can pass `--allow-fetch ` as a parameter to ``react-native-xcode ``.
72+ debug symbols and sourcemaps. If you however are using bitcode you will
73+ need to disable the "Upload Debug Symbols to Sentry" build phase and then
74+ separately upload debug symbols from iTunes Connect to Sentry.
8775
8876Android Specifics
8977-----------------
9078
9179For Android we hook into gradle for the sourcemap build process. When you
92- run ``react-native link `` the gradle files are automatically updated but
93- in case you are not using linked frameworks you might have to do it
94- manually. Whenever you run ``./gradlew assembleRelease `` sourcemaps are
95- automatically built and uploaded to Sentry.
96-
97- To enable the gradle integration you need to change your
98- ``android/app/build.gradle `` file and add the following line after the
99- ``react.gradle `` one::
100-
101- apply from: "../../node_modules/react-native-sentry/sentry.gradle"
102-
103- Additionally you need to create an ``android/sentry.properties `` file with
104- the access credentials:
105-
106- .. sourcecode :: ini
107-
108- defaults.org=___ORG_NAME___
109- defaults.project=___PROJECT_NAME___
110- auth.token=YOUR_AUTH_TOKEN
80+ run ``react-native link `` the gradle files are automatically updated.
81+ When you run ``./gradlew assembleRelease `` sourcemaps are automatically
82+ built and uploaded to Sentry.
11183
11284Client Configuration
11385--------------------
11486
115- Note: When you run ``react-native link `` we will attempt to automatically
116- patch your code so you might notice that some of these changes were
117- already performed.
118-
119- Add Sentry to your `index.ios.js ` and `index.android.js `:
87+ Note: When you run ``react-native link `` we will automatically update your
88+ `index.ios.js ` / `index.android.js ` with the following changes:
12089
12190.. sourcecode :: javascript
12291
12392 import { Sentry } from 'react-native-sentry';
124-
12593 Sentry.config('___DSN___').install();
12694
127- If you are using the binary version of the package (eg: you ran
128- ``react-native link ``) then you additionally need to register the native
129- crash handler in your `AppDelegate.m ` after the root view was created for
130- iOS:
131-
132- .. sourcecode :: objc
133-
134- #if __has_include(<React/RNSentry.h>)
135- #import <React/RNSentry.h> // This is used for versions of react >= 0.40
136- #else
137- #import "RNSentry.h" // This is used for versions of react < 0.40
138- #endif
139-
140- /* in your didFinishLaunchingWithOptions */
141- [RNSentry installWithRootView:rootView];
95+ You can pass additional configuration options to the `config() ` method if
96+ you want to do so.
14297
143- More
144- ----
98+ Deep Dive
99+ ---------
145100
146101.. toctree ::
147102 :maxdepth: 2
150105 expo
151106 sourcemaps
152107 cocoapods
108+ manual-setup
0 commit comments