Solve the error of Xcode running IOS: redefinition of module 'Firebase' and could not build module 'CoreFoundation'

Problem Description

Take over an old project, the computer environment is MacOS 13, Xcode 14.3.
It used to run normally on Xcode13, but it reported the following error when running on Xcode14.

/Users/macbilal/macreact/casual_job/test/ios/Pods/Firebase/CoreOnly/Sources/module.modulemap:1:8: error: redefinition of module 'Firebase'
module Firebase {
    
    
       ^
/Users/macbilal/Library/Developer/Xcode/DerivedData/test-dxkfhcjhlhtazgekeixnrzmjdjaz/SourcePackages/checkouts/firebase-ios-sdk/CoreOnly/Sources/module.modulemap:1:8: note: previously defined here
module Firebase {
    
    
       ^
..... <there are more lines, which are similar to the above>
1 error generated.

Error (Xcode): could not build module 'ObjectiveC' /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.2.sdk/usr/include/os/object.h:113:8

Error (Xcode): could not build module 'os_object' /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.2.sdk/usr/include/dispatch/dispatch.h:62:9

Error (Xcode): could not build module 'os_object' /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.2.sdk/usr/include/os/workgroup_base.h:18:9

Error (Xcode): could not build module 'Dispatch' /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.2.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFStream.h:19:9

Error (Xcode): could not build module 'CoreFoundation' /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:5:9

Error (Xcode): could not build module 'CoreFoundation' /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.2.sdk/System/Library/Frameworks/Security.framework/Headers/SecBase.h:27:9

Error (Xcode): could not build module 'CoreFoundation' /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.2.sdk/System/Library/Frameworks/CFNetwork.framework/Headers/CFNetwork.h:17:9

Error (Xcode): could not build module 'Foundation' /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h:7:8

Error (Xcode): could not build module 'CoreFoundation' /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.2.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGBase.h:11:9

Error (Xcode): could not build module 'CoreGraphics' /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.2.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImageDefines.h:16:9

Error (Xcode): could not build module 'CoreFoundation' /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.2.sdk/System/Library/Frameworks/CoreVideo.framework/Headers/CVBase.h:29:9

Error (Xcode): could not build module 'CoreFoundation' /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.2.sdk/System/Library/Frameworks/IOSurface.framework/Headers/IOSurfaceBase.h:35:9

Error (Xcode): could not build module 'Foundation' /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.2.sdk/System/Library/Frameworks/OpenGLES.framework/Headers/EAGL.h:7:9

Error (Xcode): could not build module 'Foundation' /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.2.sdk/System/Library/Frameworks/Metal.framework/Headers/MTLTypes.h:7:8

Error (Xcode): could not build module 'CoreFoundation' /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.2.sdk/System/Library/Frameworks/ImageIO.framework/Headers/ImageIOBase.h:15:9 Error (Xcode): could not build module 'CoreFoundation' /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.2.sdk/System/Library/Frameworks/CoreText.framework/Headers/CTFontTraits.h:13:9

Error (Xcode): could not build module 'CoreFoundation' /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.2.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/CABase.h:15:9

Error (Xcode): could not build module 'Foundation' /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.2.sdk/System/Library/Frameworks/FileProvider.framework/Headers/NSFileProviderDomain.h:7:8

Error (Xcode): could not build module 'Foundation' /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.2.sdk/System/Library/Frameworks/UserNotifications.framework/Headers/NSString+UserNotifications.h:7:8

Error (Xcode): could not build module 'UIKit' /Users/usuario/Documents/GitHub/valdivia-asociados-app/build/ios/Debug-iphonesimulator/Flutter.framework/Headers/FlutterAppDelegate.h:7:8

Error (Xcode): could not build module 'CoreFoundation' /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.2.sdk/System/Library/Frameworks/CoreMedia.framework/Headers/CMBase.h:166:9

Error (Xcode): could not build module 'CoreFoundation' /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.2.sdk/System/Library/Frameworks/CoreAudioTypes.framework/Headers/CoreAudioBaseTypes.h:17:9

Error (Xcode): could not build module 'CoreAudioTypes' /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.2.sdk/System/Library/Frameworks/CoreAudio.framework/Headers/CoreAudioTypes.h:3:9

Error (Xcode): could not build module 'Flutter' /Users/usuario/Documents/GitHub/valdivia-asociados-app/ios/Runner/GeneratedPluginRegistrant.h:9:8

Error (Xcode): failed to emit precompiled header '/Users/usuario/Library/Developer/Xcode/DerivedData/Runner-arkjnantpvustwgwgpubahjupcap/Build/Intermediates.noindex/PrecompiledHeaders/Runner-Bridging-Header-swift_2SDB0BH26RSRB-clang_2PKV74KGMIP1K.pch' for bridging header '/Users/usuario/Documents/GitHub/valdivia-asociados-app/ios/Runner/Runner-Bridging-Header.h'

Could not build the application for the simulator. Error launching application on iPhone 14 Pro.

solution

online solutions

Do as follows, but the problem still exists.

  1. Exit Xcode first, delete the ~/Library/Developer/Xcode/DerivedData directory
  2. Delete .xcworkspace in the ios directory
  3. Delete the Podfile.lock file and the Pods directory
  4. Run in the ios directorypod install
  5. Open the regenerated .xcworkspace, rerun in xcode.

final solution

Open the IOS project in Xcode and select the project on the left.
Then select the project in the right projet. In Package Dependencies, if you find redundant dependencies, select and click -Move Dependencies.
insert image description here
Finally recompile back to normal.

Guess you like

Origin blog.csdn.net/adojayfan/article/details/130411063