sentry-react-native icon indicating copy to clipboard operation
sentry-react-native copied to clipboard

iOS Use of undeclared identifier

Open ajouve opened this issue 2 years ago • 30 comments

OS:

  • [ ] Windows
  • [x] MacOS
  • [ ] Linux

Platform:

  • [x] iOS
  • [ ] Android

SDK:

  • [x] @sentry/react-native (>= 1.0.0)
  • [ ] react-native-sentry (<= 0.43.2)

SDK version: 5.23.0

react-native version: 0.73.7

Are you using Expo?

  • [ ] Yes
  • [x] No

Are you using sentry.io or on-premise?

  • [x] sentry.io (SaaS)
  • [ ] on-premise

I have the following issue:

When I am trying to run or archive on xcode I have the following errors

- node_modules/@sentry/react-native/ios/RNSentry.mm:565:27 Use of undeclared identifier 'kSentryLevelFatal'
- node_modules/@sentry/react-native/ios/RNSentry.mm:567:27 Use of undeclared identifier 'kSentryLevelWarning'
- node_modules/@sentry/react-native/ios/RNSentry.mm:569:27 Use of undeclared identifier 'kSentryLevelError'
- node_modules/@sentry/react-native/ios/RNSentry.mm:571:27 Use of undeclared identifier 'kSentryLevelDebug'
- node_modules/@sentry/react-native/ios/RNSentry.mm:573:27 Use of undeclared identifier 'kSentryLevelInfo'; did you mean 'sentryLevel'?

I tried to remove node_modules, package-lock.json, ios/Pods, ios/Podfile.lock, then reinstall, install pods and clear cache on xcode and I still have the same issue

I also tried with module version 5.22.0, 5.22.1, 5.22.2 and 5.22.3 and I have the same issue

Steps to reproduce:

  • Step 1: npx @sentry/wizard -s -i reactNative
  • Step 2: install pods
  • Step 3: Build or archive

Actual result:

Errors

Expected result:

Should build

ajouve avatar Jun 05 '24 18:06 ajouve

Same issue when building my project after updating rn sentry to the latest version >>:

› Compiling @sentry/react-native Pods/RNSentry » RNSentry.mm

❌ (node_modules/@sentry/react-native/ios/RNSentry.mm:565:27)

563 | SentryLevel sentryLevel; 564 | if ([levelString isEqualToString:@"fatal"]) {

565 | sentryLevel = kSentryLevelFatal; | ^ use of undeclared identifier 'kSentryLevelFatal' 566 | } else if ([levelString isEqualToString:@"warning"]) { 567 | sentryLevel = kSentryLevelWarning; 568 | } else if ([levelString isEqualToString:@"error"]) {

❌ (node_modules/@sentry/react-native/ios/RNSentry.mm:567:27)

565 | sentryLevel = kSentryLevelFatal; 566 | } else if ([levelString isEqualToString:@"warning"]) {

567 | sentryLevel = kSentryLevelWarning; | ^ use of undeclared identifier 'kSentryLevelWarning' 568 | } else if ([levelString isEqualToString:@"error"]) { 569 | sentryLevel = kSentryLevelError; 570 | } else if ([levelString isEqualToString:@"debug"]) {

❌ (node_modules/@sentry/react-native/ios/RNSentry.mm:569:27)

567 | sentryLevel = kSentryLevelWarning; 568 | } else if ([levelString isEqualToString:@"error"]) {

569 | sentryLevel = kSentryLevelError; | ^ use of undeclared identifier 'kSentryLevelError' 570 | } else if ([levelString isEqualToString:@"debug"]) { 571 | sentryLevel = kSentryLevelDebug; 572 | } else {

❌ (node_modules/@sentry/react-native/ios/RNSentry.mm:571:27)

569 | sentryLevel = kSentryLevelError; 570 | } else if ([levelString isEqualToString:@"debug"]) {

571 | sentryLevel = kSentryLevelDebug; | ^ use of undeclared identifier 'kSentryLevelDebug' 572 | } else { 573 | sentryLevel = kSentryLevelInfo; 574 | }

❌ (node_modules/@sentry/react-native/ios/RNSentry.mm:573:27)

571 | sentryLevel = kSentryLevelDebug; 572 | } else {

573 | sentryLevel = kSentryLevelInfo; | ^ use of undeclared identifier 'kSentryLevelInfo'; did you mean 'sentryLevel'? 574 | } 575 | [breadcrumbInstance setLevel:sentryLevel]; 576 |

mpanac avatar Jun 05 '24 18:06 mpanac

For me, the problem happens after removing yarn.lock file and run yarn install again.

w1ll-dev avatar Jun 05 '24 18:06 w1ll-dev

This is happening for me after merging two branches, one of which had Sentry in it. I have made sure the Sentry pod was updated, wiped out node_modules and re-ran yarn install, re-ran the Sentry NPM install wizard, but the issue persists. It looks like there have been no changes to those identifiers in ios/RNSentry.mm since at least 5.19.0.

charlesfsl avatar Jun 05 '24 20:06 charlesfsl

Same issue

ashadnasim52 avatar Jun 05 '24 20:06 ashadnasim52

Same issue!

manfredxu99 avatar Jun 06 '24 01:06 manfredxu99

Is there any solution tried other version also, but same error 😔

ashadnasim52 avatar Jun 06 '24 01:06 ashadnasim52

Same issue. Do you have any update on this, please?

"react-native": "0.72.0",
"@sentry/react-native": "^5.23.0",

LuckyMadu avatar Jun 06 '24 05:06 LuckyMadu

Pls update version follow here,it will be fixed: "@sentry/react-native": "5.20.0"

lozyloop12 avatar Jun 06 '24 05:06 lozyloop12

@lozyloop12 Earlier, I tried with 5.20.0 and I had the caret symbol there. Thank you, mate.

LuckyMadu avatar Jun 06 '24 06:06 LuckyMadu

Same issue

EricNetsch avatar Jun 06 '24 07:06 EricNetsch

same issue :"

astikatika avatar Jun 06 '24 07:06 astikatika

Same issue image

rodrigodiasf1984 avatar Jun 06 '24 07:06 rodrigodiasf1984

@EricNetsch Try with "@sentry/react-native": "5.20.0". It worked for me.

LuckyMadu avatar Jun 06 '24 07:06 LuckyMadu

Thanks, I backdated to "@sentry/react-native": "5.20.0" and it looks like its working again for me

yarn install
pod update

EricNetsch avatar Jun 06 '24 07:06 EricNetsch

Same issue updating "@sentry/react-native": "5.20.0". is not worked pod install showing RNSentry version 5.23.0

Binishatk avatar Jun 06 '24 09:06 Binishatk

@Binishatk try to delete Podfile.lock file then run pod install

astikatika avatar Jun 06 '24 09:06 astikatika

@Binishatk try to delete Podfile.lock file then run pod install

it doesn't wokr, i've removed the Pods, build and Podfile.lock

run pod install --repo-update and the error persist

rodrigodiasf1984 avatar Jun 06 '24 09:06 rodrigodiasf1984

"@sentry/react-native": "5.22.3", worked for me.

camilossantos2809 avatar Jun 06 '24 10:06 camilossantos2809

Pls update version follow here,it will be fixed: "@sentry/react-native": "5.20.0"

It worked 😊

ashadnasim52 avatar Jun 06 '24 12:06 ashadnasim52

Confirmed that it's now working for me with 5.22.3. At the start of this, when this issue first started for me, I was on 5.22.2. I tried updating to 5.23.0 as a first step to try and fix it. Looks like the OP had this issue on "5.22.0, 5.22.1, 5.22.2 and 5.22.3".

charlesfsl avatar Jun 06 '24 14:06 charlesfsl