Xcode运行RxSwift Playground报错:无法加载swiftQuartzCore库
在Xcode 15.1中运行RxSwift Playground时出现报错:
error: error while processing module import: Failed to load linked library swiftQuartzCore of module RxSwift - errors:
当前使用RxSwift 6.1.0、RxCocoa 6.1.0,已排查相关issue但未解决。
检查Playground平台配置
打开Playground右侧检查器,确认Platform选择iOS或macOS,Deployment Target不低于RxSwift 6.1.0要求的iOS 10.0/macOS 10.12。清理并重装依赖
若使用CocoaPods,执行以下命令:pod deintegrate pod cache clean --all pod install若使用Swift Package Manager,先移除RxSwift依赖,重新添加6.1.0版本,再执行
File > Packages > Reset Package Caches。手动添加QuartzCore框架
打开Playground关联的项目设置,在Frameworks, Libraries, and Embedded Content中添加QuartzCore.framework,设置状态为Do Not Embed。调整导入顺序
在Playground代码开头先导入QuartzCore:import QuartzCore import RxSwift import RxCocoa版本兼容调整
Xcode 15.1和RxSwift 6.1.0可能存在兼容性问题,可选择升级RxSwift到6.6.0及以上版本(官方已适配Xcode 15),或暂时降级到Xcode 14.x版本运行。
内容的提问来源于stack exchange,提问作者jiexishede

