解决Xcode运行IOS报错:redefinition of module ‘Firebase‘和could not build module ‘CoreFoundation‘

简介: 解决Xcode运行IOS报错:redefinition of module ‘Firebase‘和could not build module ‘CoreFoundation‘

问题描述

接手一个老项目,电脑环境是MacOS 13,Xcode 14.3。

以前在Xcode13上能正常运行,在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.

解决方案

网上的解决方法

  1. 先退出Xcode,删除~/Library/Developer/Xcode/DerivedData目录
  2. 删除ios目录中的.xcworkspace
  3. 删除Podfile.lock文件and Pods目录
  4. 在ios的目录下运行pod install
  5. 打开重新生成的.xcworkspace,在xcode中重新运行。

最终解决的方法

Xcode中打开IOS项目,选择左侧的项目。

然后在右侧projet中选择项目,在Package Dependencies中,如果发现有多余的依赖,选择后点击-移动依赖。


最后重新编译恢复正常。

相关文章
|
3月前
|
iOS开发 开发者
解决xcode doesn‘t support iphone’s ios 14.6 (18f72)
解决xcode doesn‘t support iphone’s ios 14.6 (18f72)
260 3
|
3月前
|
Swift iOS开发
iOS Swift使用Alamofire请求本地服务器报错-1002
iOS Swift使用Alamofire请求本地服务器报错-1002
95 1
|
2月前
|
iOS开发
url中带中文,ios报错问题
url中带中文,ios报错问题
|
3月前
|
开发工具 iOS开发
解决Flutter运行报错Could not run build/ios/iphoneos/Runner.app
解决Flutter运行报错Could not run build/ios/iphoneos/Runner.app
140 2
|
3月前
|
iOS开发 Perl
解决Xcode15报错:DT_TOOLCHAIN_DIR cannot be used to evaluate LIBRARY_SEARCH_PATHS
解决Xcode15报错:DT_TOOLCHAIN_DIR cannot be used to evaluate LIBRARY_SEARCH_PATHS
157 1
|
3月前
|
iOS开发
IOS编译报错‘ZipArchive.h‘ file not found|Use of undeclared identifier ‘SSZipArchive‘
IOS编译报错‘ZipArchive.h‘ file not found|Use of undeclared identifier ‘SSZipArchive‘
60 1
|
3月前
|
缓存 iOS开发
如何在Xcode删除某个版本的IOS模拟器
如何在Xcode删除某个版本的IOS模拟器
586 1
|
3月前
|
iOS开发
解决Flutter运行IOS报错:Podfile is out of date
解决Flutter运行IOS报错:Podfile is out of date
74 1
|
3月前
|
存储 iOS开发 Perl
ios-解决报错-CocoaPods could not find compatible versions for pod “xxx“
ios-解决报错-CocoaPods could not find compatible versions for pod “xxx“
172 2
|
3月前
|
iOS开发
mac不通过Xcode直接打开IOS模拟器
mac不通过Xcode直接打开IOS模拟器
220 2