Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions sample/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@ platform :ios, '15.1'

use_frameworks! :linkage => :static

# WORKAROUND: Usercentrics.xcframework links `-framework Sentry` eagerly at the binary level
# (a real dynamic dyld load command), but `use_frameworks! :linkage => :static` above makes
# CocoaPods build every pod — including Sentry — as a static archive with no Sentry.framework
# bundle ever embedded in the app. That crashes every launch with "Library not loaded:
# @rpath/Sentry.framework/Sentry". Force only the Sentry pod to build as a dynamic framework
# so the real Sentry.framework exists and gets embedded, matching what the binary expects.
# WORKAROUND: Usercentrics.xcframework links Sentry weakly (mobile-sdk MSDK-4862 — a missing/
# mismatched Sentry.framework no longer crashes the app at launch), but still expects a real
# dynamic Sentry.framework to actually be present for SdkMonitor's crash reporting to function.
# `use_frameworks! :linkage => :static` above makes CocoaPods build every pod — including
# Sentry — as a static archive with no Sentry.framework bundle ever embedded in the app, which
# would silently leave SdkMonitor's crash reporting non-functional (no crash, no error — it
# just never sends anything). Force only the Sentry pod to build as a dynamic framework so the
# real Sentry.framework exists and gets embedded, matching what the binary expects.
Comment on lines +24 to +31

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[VALIDATION] The new comment correctly describes the weak-link behavior introduced by MSDK-4862, but it's important to make the comment actionable and traceable: add an explicit link or commit/PR reference to the mobile-sdk change (e.g. PR #2544 or commit SHA) and the target released version that will contain the fix. Also add a TODO that documents when this Podfile workaround should be removed (e.g. "TODO: remove this workaround once mobile-sdk vX.Y.Z with MSDK-4862 is published"). This prevents the comment from becoming stale and helps reviewers know when it's safe to remove the workaround.

# WORKAROUND: Usercentrics.xcframework links Sentry weakly (mobile-sdk MSDK-4862 —
# see https://bitbucket.org/usercentricscode/mobile-sdk/pull-requests/2544)
# A missing/mismatched Sentry.framework no longer crashes the app at launch, but
# SdkMonitor’s crash reporting still requires a real dynamic Sentry.framework.
# `use_frameworks! :linkage => :static` above makes CocoaPods build every pod —
# including Sentry — as a static archive with no Sentry.framework bundle ever
# embedded in the app, which would silently leave SdkMonitor’s crash reporting
# non-functional (no crash, no error — it just never sends anything).
# TODO(MSDK-4862): remove this workaround once a released mobile-sdk version
# including this fix is consumed in this sample app.
# Force only the Sentry pod to build as a dynamic framework so the real
# Sentry.framework exists and gets embedded, matching what the binary expects.
pre_install do |installer|
  installer.pod_targets.each do |pod_target|
    if pod_target.name&.start_with?('Sentry')
      def pod_target.build_type
        Pod::BuildType.dynamic_framework
      end
    end
  end
end

pre_install do |installer|
installer.pod_targets.each do |pod_target|
if pod_target.name.start_with?('Sentry')
Expand Down
Loading