grafana / grafana/faro-react-native-sdk

[iOS] FaroReactNative-Swift.h not found with use_frameworks! :linkage => :static

Open Beginner friendly
#135 1 comment 2 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
9
Forks
4
Avg merge
1d 18h
Merged PRs (30d)
9

Description

`@grafana/faro-react-native@1.3.1` fails to compile on iOS when the application uses CocoaPods static frameworks:

```ruby
use_frameworks! :linkage => :static
```

The build fails in `FaroReactNativeModule.mm`:

```
FaroReactNativeModule.mm:3:9: fatal error:
'FaroReactNative-Swift.h' file not found

#import "FaroReactNative-Swift.h"
^~~~~~~~~~~~~~~~~~~~~~~~~
```

Xcode successfully generates the Swift compatibility header and places it in `FaroReactNative.framework/Headers`, but the unqualified quoted import does not resolve it when Faro is built as a framework.
Changing the import to the framework-qualified form fixes the build:
```
#import
```

### Environment
* @grafana/faro-react-native: 1.3.1
* React Native: 0.85.3
* Expo: 56.0.5
* Xcode: 26.3 (17C529)
* CocoaPods: 1.16.2
* iOS deployment target: 16.4
* Framework linkage: static

### Verified workaround
```diff
Applying this patch fixes the build:
#import "FaroReactNativeModule.h"
#import
-#import "FaroReactNative-Swift.h"
+#import
```

Maybe it should be smth like

```objc
#if __has_include()
#import
#else
#import "FaroReactNative-Swift.h"
#endif
```

Contributor guide

Open the contributing guide

Research direction

Start in FaroReactNativeModule.mm and inspect how the generated Swift compatibility header is imported. Verify the framework-qualified import against the CocoaPods static-framework configuration described in the issue, then build the iOS application with use_frameworks! :linkage => :static to confirm the missing-header error is resolved.

Written by the indexing model from the issue text.

Assessment

Tech stack
objective-c, react-native, swift
Domain
build-system, mobile-dev
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
82/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.