#Getting errors on SentryFlutter.swift when building to iOS with Flutter

4 messages · Page 1 of 1 (latest)

outer kiln
#

Got these error when I'm building to iOS with flutter

Running pod install...                                             13.7s
Running Xcode build...                                          
Xcode archive done.                                         38.8s
Failed to build iOS app
Swift Compiler Error (Xcode): Value of type 'Options' has no member 'sessionReplay'
/Users/macbuild/.pub-cache/hosted/pub.dev/sentry_flutter-8.14.2/ios/sentry_flutter/Sources/sentry_flutter/SentryFlutter.swift:118:28
Swift Compiler Error (Xcode): Value of type 'Options' has no member 'sessionReplay'
/Users/macbuild/.pub-cache/hosted/pub.dev/sentry_flutter-8.14.2/ios/sentry_flutter/Sources/sentry_flutter/SentryFlutter.swift:120:28
Swift Compiler Error (Xcode): Value of type 'Options' has no member 'sessionReplay'
/Users/macbuild/.pub-cache/hosted/pub.dev/sentry_flutter-8.14.2/ios/sentry_flutter/Sources/sentry_flutter/SentryFlutter.swift:122:28
Swift Compiler Error (Xcode): Value of type 'Options' has no member 'sessionReplay'
/Users/macbuild/.pub-cache/hosted/pub.dev/sentry_flutter-8.14.2/ios/sentry_flutter/Sources/sentry_flutter/SentryFlutter.swift:124:24
Swift Compiler Error (Xcode): Value of type 'Options' has no member 'sessionReplay'
/Users/macbuild/.pub-cache/hosted/pub.dev/sentry_flutter-8.14.2/ios/sentry_flutter/Sources/sentry_flutter/SentryFlutter.swift:126:24
Swift Compiler Error (Xcode): Value of type 'Options' has no member 'sessionReplay'
/Users/macbuild/.pub-cache/hosted/pub.dev/sentry_flutter-8.14.2/ios/sentry_flutter/Sources/sentry_flutter/SentryFlutter.swift:130:24
Swift Compiler Error (Xcode): Value of type 'SentryDebugImageProvider' has no member 'getDebugImagesForImageAddressesFromCache'
/Users/macbuild/.pub-cache/hosted/pub.dev/sentry_flutter-8.14.2/ios/sentry_flutter/Sources/sentry_flutter/SentryFlutterPlugin.swift:275:15
Swift Compiler Error (Xcode): Value of type 'Options' has no member 'sessionReplay'
/Users/macbuild/.pub-cache/hosted/pub.dev/sentry_flutter-8.14.2/ios/sentry_flutter/Sources/sentry_flutter/SentryFlutterPlugin.swift:359:67
Swift Compiler Error (Xcode): Type 'PrivateSentrySDKOnly' has no member 'setReplayTags'
/Users/macbuild/.pub-cache/hosted/pub.dev/sentry_flutter-8.14.2/ios/sentry_flutter/Sources/sentry_flutter/SentryFlutterPlugin.swift:370:32
Uncategorized (Xcode): Command SwiftCompile failed with a nonzero exit code

my pubspec sentry version is at ^8.14.1

What do I need to do to fix this?

half matrixBOT
#

Hi @outer kiln. I'm happy to dig into this for you! I'll check my internal sources for answers to your question! :wave:

#

Based on the error messages you're encountering, you're facing compatibility issues between the Sentry Flutter SDK and iOS. This is a known issue that has been reported in several GitHub issues for the sentry-dart repository.

The Problem

The errors indicate that there are missing members in the Swift code, particularly related to session replay functionality and debug image providers. These errors typically occur when:

  1. There's a mismatch between the Sentry Flutter SDK version and the underlying Sentry iOS SDK
  2. You're using a newer version of Xcode/iOS that isn't fully compatible with the current Sentry implementation

Solutions

Here are some approaches to fix this issue:

1. Update to the latest version

Try updating to the absolute latest version of sentry_flutter. In your pubspec.yaml, specify:

sentry_flutter: ^8.14.2

Then run:

flutter pub get
flutter clean
cd ios
pod install --repo-update
cd ..

2. Clean your build environment

Several users have reported success by thoroughly cleaning their build environment:

flutter clean
rm -rf ~/Library/Developer/Xcode/DerivedData/*
cd ios
pod deintegrate
pod install --repo-update

This solution has worked for many users with similar issues as reported in this GitHub issue.

3. Check Podfile configuration

For some iOS build issues with Sentry, modifying the Podfile has helped. You can try adding this to your Podfile:

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

4. Specific iOS 18.4 Beta issue

#

If you're using iOS 18.4 Beta, there's a known issue with Sentry Flutter SDK compatibility as reported in this GitHub issue. In this case, you might need to wait for an update from the Sentry team or temporarily disable Sentry in your app when building for iOS.

Common pattern in these issues

Looking at the knowledge sources, there's a pattern of Swift compiler errors with Sentry when using newer iOS versions or Xcode versions. The Sentry team typically addresses these in newer releases, so updating to the latest version is often the best solution.

If none of these solutions work, you might need to temporarily remove or disable Sentry in your app until a compatible version is released.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: