我正在使用 CircleCI 为 iOS(和 Android)构建,最近,iOS 构建失败并显示以下错误消息:
Compiling RNSentry.m
❌ /Users/distiller/project/node_modules/@sentry/react-native/ios/RNSentry.m:107:79: property 'options' not found on object of type 'PrivateSentrySDKOnly'
if (appIsActive && !sentHybridSdkDidBecomeActive && (PrivateSentrySDKOnly.options.enableAutoSessionTracking || PrivateSentrySDKOnly.options.enableOutOfMemoryTracking)) {
^
❌ /Users/distiller/project/node_modules/@sentry/react-native/ios/RNSentry.m:107:137: property 'options' not found on object of type 'PrivateSentrySDKOnly'
if (appIsActive && !sentHybridSdkDidBecomeActive && (PrivateSentrySDKOnly.options.enableAutoSessionTracking || PrivateSentrySDKOnly.options.enableOutOfMemoryTracking)) {
^
❌ /Users/distiller/project/node_modules/@sentry/react-native/ios/RNSentry.m:155:39: property 'getSdkName' not found on object of type 'PrivateSentrySDKOnly'
@"name": PrivateSentrySDKOnly.getSdkName,
^
❌ /Users/distiller/project/node_modules/@sentry/react-native/ios/RNSentry.m:195:34: property 'options' not found on object of type 'PrivateSentrySDKOnly'
if (PrivateSentrySDKOnly.options.debug
曾经为iOS构建过,我认为这与Sentry的版本有关;我想我尝试将Sentry版本更新到4.9.0,却发现4.9.0有一些严重的问题(我认为)。我不够聪明,无法准确解读这里的结论,但我认为它是相关的:
https://github.com/getsentry/sentry-cocoa/issues/1665 https://github.com/getsentry/sentry-react-native/issues/2530 (我正在寻找另一个相关的网址,但现在找不到)
Android 可以使用配置等进行构建,但 iOS 会失败。我可以做什么来解决这个问题?
package.json有Sentry 4.8.0:
"dependencies": {
"@react-native-async-storage/async-storage": "^1.17.4",
"@react-native-community/cli-platform-android": "^6.3.0",
"@sentry/react-native": "4.8.0",
"@turf/distance": "^6.0.1",
"axios": "^1.1.1",
"dotenv": "^16.0.0",
"eventing-bus": "^2.0.1",
"jetifier": "^2.0.0",
"lodash": "^4.17.15",
"moment": "^2.29.3",
"moment-timezone": "^0.5.34",
"patch-package": "^6.4.7",
"react": "17.0.2",
"react-native": "0.67.4",
这是我的其余配置/设置:
PS C:\Github\alfaonlinev3> npx react-native doctor
Common
✓ Node.js
✓ yarn
Android
✓ JDK
✖ Android Studio - Required for building and installing your app on Android
✓ Android SDK - Required for building and installing your app on Android
✓ ANDROID_HOME
Errors: 1
Warnings: 0
注意:我安装了 Android Studio,它适用于 Android 原生项目。不知道医生为何抱怨或如何解决,除了下载另一个 Android studio 副本?
envinfo:
Visual Studio code: 1.73.1
System:
OS: Windows 10 10.0.19044
CPU: (24) x64 AMD Ryzen 9 3900X 12-Core Processor
Memory: 5.01 GB / 31.95 GB
Binaries:
Node: 16.15.0 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.4 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 8.5.5 - C:\Program Files\nodejs\npm.CMD
Managers:
pip2: 19.2.3 - C:\Python27\Scripts\pip2.EXE
pip3: 21.1.1 - C:\Python39\Scripts\pip3.EXE
Utilities:
Git: 2.34.1.
SDKs:
Android SDK:
API Levels: 28, 29, 30, 31, 33
Build Tools: 28.0.3, 29.0.0, 29.0.2, 29.0.3, 30.0.2, 30.0.3, 31.0.0
Windows SDK:
AllowDevelopmentWithoutDevLicense: Enabled
IDEs:
VSCode: 1.73.1 - C:\Program Files\Microsoft VS Code\bin\code.CMD
Visual Studio: 17.3.32519.111 (Visual Studio Community 2022), 16.11.32106.194 (Visual Studio Community 2019)
Languages:
Java: 19.0.1
Python: 3.9.5
Databases:
SQLite: 3.32.2 - C:\Users\wagge\AppData\Local\Android\Sdk\platform-tools\sqlite3.EXE
Browsers:
Chrome: 107.0.5304.121
Edge: Spartan (44.19041.1266.0), Chromium (107.0.1418.56)
Internet Explorer: 11.0.19041.1566
IDEs:
Android Studio: Not Found
Visual Studio: 17.3.32519.111 (Visual Studio Community 2022), 16.11.32106.194 (Visual Studio Community 2019)
Languages:
Java: 19.0.1
npmPackages:
@react-native-community/cli: Not Found
react: 17.0.2 => 17.0.2
react-native: 0.67.4 => 0.67.4
react-native-windows: Not Found
npmGlobalPackages:
*react-native*: Not Found
更新
我运行了npm-update,它建议将sentry更新到4.10.1。完成后,我在 package.json 中看到了这个变化:
还有yarn.lock
但是,构建仍然失败并出现相同的错误。
更新2
我检查了 podfile.*,我看到了类似的东西:
podfile.lock:
- RNSentry (3.4.2):
- React-Core
- Sentry (= 7.11.0)
- RNSnackbar (2.4.0):
- React-Core
- RNSVG (9.13.6):
- React
- Sentry (7.11.0):
- Sentry/Core (= 7.11.0)
- Sentry/Core (7.11.0)
文件
podfile
根本不包含“哨兵”。
看起来这是你的问题:
https://github.com/getsentry/sentry-react-native/pull/2599/files
尝试将React Native Sentry升级到4.10.1
从您的
podfile.lock
来看,您似乎安装了旧版本的 RNSentry
pod。
- RNSentry (3.4.2):
尝试运行以下命令:
cd ios
pod update RNSentry
RNSentry
必须与@sentry/react-native
版本相同。所以就你而言,它应该是4.10.1
。