getsentry / sentry-dart

Sentry SDK for Dart and Flutter
https://sentry.io/for/flutter/
MIT License
761 stars 239 forks source link

Semantic Issue (Xcode): Cannot find protocol declaration for 'SentryMXManagerDelegate' #2122

Closed monisnap-jeremie closed 3 months ago

monisnap-jeremie commented 4 months ago

Platform

Flutter Mobile

Obfuscation

Enabled

Debug Info

Enabled

Doctor

[✓] Flutter (Channel stable, 3.22.2, on macOS 14.5 23F79 darwin-arm64, locale en-GB) • Flutter version 3.22.2 on channel stable at /Users/timer/fvm/versions/3.22.2 • Upstream repository https://github.com/flutter/flutter.git • Framework revision 761747bfc5 (2 weeks ago), 2024-06-05 22:15:13 +0200 • Engine revision edd8546116 • Dart version 3.4.3 • DevTools version 2.34.3

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) • Android SDK at /Users/timer/Library/Android/sdk • Platform android-34, build-tools 34.0.0 • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 17.0.9+0-17.0.9b1087.7-11185874) • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.4) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 15F31d • CocoaPods version 1.15.2

[✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2023.2) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 17.0.9+0-17.0.9b1087.7-11185874)

[✓] VS Code (version 1.90.2) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.90.0

[✓] Connected device (5 available)
• iPhone de Jéjé (mobile) • 00008120-000275381AEB401E • ios • iOS 17.5.1 21F90 • iPhone 15 Pro (mobile) • 287857A1-BBE2-420F-8A3C-59E4927D554A • ios • com.apple.CoreSimulator.SimRuntime.iOS-17-5 (simulator) • macOS (desktop) • macos • darwin-arm64 • macOS 14.5 23F79 darwin-arm64 • Mac Designed for iPad (desktop) • mac-designed-for-ipad • darwin • macOS 14.5 23F79 darwin-arm64 • Chrome (web) • chrome • web-javascript • Google Chrome 126.0.6478.62

[✓] Network resources • All expected network resources are available.

• No issues found!

Version

8.3.0

Steps to Reproduce

I am trying to build my app following an upgrade of flutter and all my packages but it could not build my app.

Expected Result

My app would build without Sentry errors.

Actual Result

Launching lib/main.dart on iPhone 15 Pro in debug mode...
Xcode build done.                                           50.8s
Failed to build iOS app
Semantic Issue (Xcode): Cannot find protocol declaration for 'SentryMXManagerDelegate'
/Users/timer/gitlab/Monisnap/Mobile/moni-app/ios/Pods/Sentry/Sources/Sentry/include/SentryMetricKitIntegration.h:23:56
SentryMetricKitIntegration.h:23

Could not build the application for the simulator.
Error launching application on iPhone 15 Pro.

Are you willing to submit a PR?

None

buenaflor commented 4 months ago

hi, is this also an issue with earlier versions of the flutter sdk?

monisnap-jeremie commented 4 months ago

@buenaflor yes, with also with the following one:

Flutter 3.13.6 • channel stable • https://github.com/flutter/flutter.git
Framework • revision ead455963c (9 months ago) • 2023-09-26 18:28:17 -0700
Engine • revision a794cf2681
Tools • Dart 3.1.3 • DevTools 2.25.0
buenaflor commented 4 months ago

@monisnap-jeremie we've had a similar issue in react-native https://github.com/getsentry/sentry-react-native/issues/3800

please check if any of the solutions there work for you

monisnap-jeremie commented 4 months ago

@buenaflor thank you, but it dit not work for me.

Currently, I have this issue when I am trying to build my iOS app.

CleanShot 2024-06-28 at 15 53 17@2x

buenaflor commented 4 months ago

which solution from that thread did you try?

monisnap-jeremie commented 4 months ago

@buenaflor In my Podfile, I have modified the following lines:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
    target.build_configurations.each do |config|
      [...]
      config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = target.name == 'Sentry' ? 'YES' : 'No'
      [...]
    end
  end
end

FYI

in my pubspec.yaml:

dependencies:
  sentry_flutter: ^8.3.0
  sentry_dio: ^8.3.0
devDependencies:
  sentry_dart_plugin: ^2.1.0

sentry:
  ignore_missing: true

in my Podfile.lock:

  - Sentry/HybridSDK (8.29.0)
  - sentry_flutter (8.3.0):
    - Flutter
    - FlutterMacOS
    - Sentry/HybridSDK (= 8.29.0)

fvm flutter version

Flutter 3.13.6 • channel stable • https://github.com/flutter/flutter.git
Framework • revision ead455963c (9 months ago) • 2023-09-26 18:28:17 -0700
Engine • revision a794cf2681
Tools • Dart 3.1.3 • DevTools 2.25.0

in main.dart:

import 'package:moni_app/services/sentry.dart';
import 'package:sentry_flutter/sentry_flutter.dart';

Future<void> main() async {
  [...]
  await SentryFlutter.init((options) {
    options.dsn = kDebugMode ? '' : EnvVars.SENTRY_API_KEY;
    options.environment = EnvVars.ENV;

    // Prevent HTTP errors from native SDK to be sent to Sentry
    options.captureFailedRequests = false;
    // Prevent "app hanging" in sentry (default was 2 seconds, which is too restrictive)
    options.appHangTimeoutInterval = const Duration(seconds: 5);
  }, appRunner: () {
    initCurrentUserListener(
      (metaUserId) async {
        await trackUser(metaUserId);
        setSentryUser(metaUserId);
      },
    );
  });
  [...]
}

fvm flutter doctor -v


[...]

[✓] Xcode - develop for iOS and macOS (Xcode 15.4) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 15F31d • CocoaPods version 1.15.2

[...]

• No issues found!

buenaflor commented 4 months ago
unless target.name == 'Sentry'
        # Iterate through each build configuration
        target.build_configurations.each do |config|
          # Modify the build settings
          config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'No'
        end
      end

can you try this? which is at the very bottom of the thread, it should be the same output of the solution you tried but let's see

getsantry[bot] commented 3 months ago

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you remove the label Waiting for: Community, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀