FBSDKCoreKit/FBSDKCoreKit.modulemap' not found while trying to Archive a react native project on XCODE

Viewed 5801

When I am trying a React native project on the IOS simulator it works fine. But when try to Archive the project to upload to the App Store, Xcode throws an error saying

fatal error: module map file '/Users/MyMac/Library/Developer/Xcode/DerivedData/<coolapp>-gsdebkxdyslzmjaypmxjdztvchbl/Build/Intermediates.noindex/ArchiveIntermediates/coolapp/BuildProductsPath/Release-iphoneos/FBSDKCoreKit/FBSDKCoreKit.modulemap' not found

When it is clearly there in the project. I have tried all the solutions posted on this GitHub thread, but none of those work. https://github.com/facebook/react-native-fbsdk/issues/780

My Environment

  • react-native: 0.63.2
  • react-native-fbsdk: ^3.0.0
  • Xcode 12.4 (12D4e)

Also tried on fbsdk 2.0.0 and code 11.0+ still the same issue.

Can anyone please help me.

3 Answers
  1. make sure you open the .xcworkspace file and not .xcproject
  2. make sure all min iOS versions are the same across your Target, Project and Podfile
  3. clean project and rebuild

It might help

I had similar issue because I was importing FBSDK at wrong place in AppDelegate.m

Point is you must import before #ifdef FB_SONARKIT_ENABLED Here is the correct way:

#import "AppDelegate.h"

#import <React/RCTBridge.h>
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
#import "FBSDKCoreKit.h" <-- IMPORT HERE! -->

#ifdef FB_SONARKIT_ENABLED
<--- DO NOT IMPORT BELOW --->
#import <FlipperKit/FlipperClient.h>
#import <FlipperKitLayoutPlugin/FlipperKitLayoutPlugin.h>
#import <FlipperKitUserDefaultsPlugin/FKUserDefaultsPlugin.h>
#import <FlipperKitNetworkPlugin/FlipperKitNetworkPlugin.h>
#import <SKIOSNetworkPlugin/SKIOSNetworkAdapter.h>
#import <FlipperKitReactPlugin/FlipperKitReactPlugin.h>

By any chance you opened on Xcode .xcodeproj file instead of .xcworkspace file?

Related