Skip to content

fix(ios): add the products dir to framework search paths for SPM link: false - #4376

Merged
mfazekas merged 1 commit into
mainfrom
fix/spm-link-false-framework-search-paths
Oct 21, 2026
Merged

mfazekas merged 1 commit into
mainfrom
fix/spm-link-false-framework-search-paths

Conversation

@mfazekas

Copy link
Copy Markdown
Contributor

Description

With $RNMapboxMapsSwiftPackageManager = { link: false }, rnmapbox-maps fails to compile on React Native 0.88 with Xcode 26:

RNMBXCamera.swift:3:8: error: compilation search paths unable to resolve module dependency: 'Turf'
error: compilation search paths unable to resolve module dependency: 'MapboxCommon'
error: compilation search paths unable to resolve module dependency: 'MapboxCoreMaps'

React Native up to 0.86 set SWIFT_ENABLE_EXPLICIT_MODULES=NO for prebuilt core; 0.87 dropped that, so Xcode 26's explicit modules are on. The explicit-module scanner finds the package's binary frameworks only on a framework search path, which a linked package product gets from Xcode but the compile-only target dependency doesn't. The same app builds with SWIFT_ENABLE_EXPLICIT_MODULES=NO, confirming the cause.

The fix adds ${SYMROOT}/${CONFIGURATION}${EFFECTIVE_PLATFORM_NAME}/ to the pod's FRAMEWORK_SEARCH_PATHS next to the existing SWIFT_INCLUDE_PATHS. It's only on the link: false path and isn't version-gated, since explicit modules can be on with older React Native too (e.g. building core from source). The Expo plugin needs no change, the hook runs from the podspec. @rnmapbox/navigation's plugin workaround for this becomes redundant; with both, the path appears once and the app builds.

Checklist

  • I've read CONTRIBUTING.md
  • I updated the doc/other generated code with running yarn generate in the root folder
  • I have tested the new feature on /example app.
    • In V11 mode/ios
    • In New Architecture mode/ios
    • In V11 mode/android
    • In New Architecture mode/android
  • I added/updated a sample - if a new feature was implemented (/example)

Tested outside /example (it's on RN 0.84), iOS 26.5 simulator, Xcode 26.6:

  1. Bare RN 0.88.0 app with link: false + @rnmapbox/[email protected]: fails with the errors above on 10.3.11, builds and renders the map with this change.
  2. Expo SDK 58 (RN 0.88.0) app with the @rnmapbox/maps and @rnmapbox/navigation plugins, the navigation plugin's FRAMEWORK_SEARCH_PATHS block removed: same failure before, builds and renders after.
  3. Bare RN 0.84.1 app (explicit modules still off) with link: false: still builds with this change.

Both fixed apps contain one Mapbox copy: MapboxMaps is statically linked into the app's .debug.dylib only ($s10MapboxMaps7MapViewCMn defined once), MapboxCommon/MapboxCoreMaps/Turf are each embedded once as frameworks, nm finds no Mapbox ObjC class or Swift type descriptor defined in more than one binary, and the launch log has no Mapbox "Class X is implemented in both" warnings.

Component to reproduce the issue you're fixing

Podfile (bare) or app.json plugins (Expo) plus any screen with a MapView:

$RNMapboxMapsSwiftPackageManager = { link: false }
# + @rnmapbox/navigation (brings MapboxMaps via the Navigation SDK Swift package)
import Mapbox, { Camera, MapView } from '@rnmapbox/maps';
import { NAVIGATION_MAP_VIEW_IMPL } from '@rnmapbox/navigation';

export default function App() {
  return (
    <MapView style={{ flex: 1 }}>
      <Camera zoomLevel={12} centerCoordinate={[-122.397, 37.792]} />
    </MapView>
  );
}

…: false

With explicit Swift modules (Xcode 26, on since react-native 0.87 stopped
setting SWIFT_ENABLE_EXPLICIT_MODULES=NO) rnmapbox-maps couldn't resolve the
MapboxCommon, MapboxCoreMaps and Turf binary frameworks, which only a framework
search path finds.
@mfazekas
mfazekas merged commit 89fd7e5 into main Oct 21, 2026
9 checks passed
@mfazekas
mfazekas deleted the fix/spm-link-false-framework-search-paths branch October 21, 2026 09:12
mfazekas added a commit to rnmapbox/navigation that referenced this pull request Oct 28, 2026
…modules

- Android Auto reports guidance to NavigationManager since #22.
- Xcode 26 explicit modules start with React Native 0.87 (rnmapbox/maps#4376).
- yarn.lock for the react-native peer range.
mfazekas added a commit to rnmapbox/navigation that referenced this pull request Oct 28, 2026
* docs: newcomer and DX fixes for 0.1.0

- README: 0.1.0 compatibility row, pre-1.0 banner, pinned @rnmapbox/maps
  install, location permission section, "Why" bullets and a migration
  table for the homee and pawan-pk packages.
- Example: request Android location permission before device-location
  guidance on the RNNavigationView screen.
- Plugin: warn at prebuild when the @rnmapbox/maps plugin's
  RNMapboxMapsVersion doesn't match the Navigation SDK's Maps version.
- package.json: react-native peer >=0.79 (as @rnmapbox/maps), more keywords.
- Feature request issue template, replacing the link to the disabled
  Discussions ideas category.

* docs: Android Auto NavigationManager and React Native 0.87+ explicit modules

- Android Auto reports guidance to NavigationManager since #22.
- Xcode 26 explicit modules start with React Native 0.87 (rnmapbox/maps#4376).
- yarn.lock for the react-native peer range.

This branch was previously deployed

1 inactive deployment
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.

1 participant