Skip to content

Conversation

@pushpender-singh-ap
Copy link
Owner

@pushpender-singh-ap pushpender-singh-ap commented Oct 2, 2025

When using use_frameworks! :linkage => :static, CocoaPods builds static frameworks instead of dynamic ones. The problem with this library arises because:

  1. It contains Swift code (CameraView and related classes)
  2. It also contains Objective-C++ code (CameraViewManager.mm)
  3. The Objective-C++ file attempts to import Swift code via #import "ReactNativeScanner-Swift.h"

Why it fails with static frameworks

  • Dynamic frameworks: CocoaPods automatically generates the bridging header (ModuleName-Swift.h), exposing Swift classes to Objective-C.
  • Static frameworks: The bridging header is not properly generated or configured unless explicitly set in the podspec.

Without the bridging header, the Objective-C++ file cannot access the Swift classes, which leads to compilation errors.

Solutions added

  • Update the podspec to explicitly enable module support
  • Explicitly set the bridging header name
  • Adjust the import statement to support both static and dynamic linkage
  • Ensure compatibility across both linkage types

This should resolve the issue and make the library work regardless of whether CocoaPods is using static or dynamic frameworks.

- The podspec explicitly enables module support
- The bridging header name is explicitly set
- The import statement handles both framework structures
- Works with both static and dynamic linkage
@pushpender-singh-ap pushpender-singh-ap self-assigned this Oct 2, 2025
@pushpender-singh-ap pushpender-singh-ap linked an issue Oct 2, 2025 that may be closed by this pull request
3 tasks
@pushpender-singh-ap pushpender-singh-ap merged commit 7c7cc24 into main Oct 2, 2025
5 of 6 checks passed
@pushpender-singh-ap pushpender-singh-ap deleted the 53-ios-build-crash-when-use_frameworks-linkage-static branch October 2, 2025 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

IOS: Build crash when use_frameworks! :linkage => :static

1 participant