You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Xcode 15 Beta+iOS17模拟器GRDB类重复实现日志报错求助

排查iOS 17模拟器下GRDB类重复实现问题

问题背景

基于Swift和SwiftUI开发的应用,使用GRDB与GRDBQuery框架,在Xcode 15 Beta搭配iOS 17模拟器启动时,日志出现42条类重复实现报错,指向系统私有框架GRDB与应用自身的GRDB类冲突。iOS 16模拟器下无此问题。

报错示例

objc[23081]: Class _TtC4GRDB18SQLStatementCursor is implemented in both /Library/Developer/CoreSimulator/Volumes/iOS_21A5248u/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.0.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/GRDB.framework/GRDB (0x1c0be3ea8) and /Users/xxxxxxx/Library/Developer/CoreSimulator/Devices/55E0C4E1-F07E-4647-A897-E7B3CCFDDB93/data/Containers/Bundle/Application/3171E5C3-F01A-4C91-B6EA-9C60A757F3C4/AppName.app/AppName (0x104de56d8). One of the two will be used. Which one is undefined.
objc[23081]: Class _TtC4GRDB8Database is implemented in both /Library/Developer/CoreSimulator/Volumes/iOS_21A5248u/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.0.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/GRDB.framework/GRDB (0x1c0be4d88) and /Users/xxxxxxxx/Library/Developer/CoreSimulator/Devices/55E0C4E1-F07E-4647-A897-E7B3CCFDDB93/data/Containers/Bundle/Application/3171E5C3-F01A-4C91-B6EA-9C60A757F3C4/AppName.app/AppName (0x104de58e0). One of the two will be used. Which one is undefined.

已尝试的解决方案

  • 移除并重新添加SPM依赖(GRDB、GRDBQuery)
  • 清理构建文件夹
  • 删除DerivedData文件夹

后续排查思路

1. 检查GRDB版本兼容性

确认当前使用的GRDB/GRDBQuery版本是否适配Xcode 15 Beta和iOS 17。优先升级到最新的测试版或正式版,看是否已修复该冲突问题。

2. 修改GRDB模块命名空间

由于iOS 17系统引入了同名的私有GRDB框架,可尝试通过SPM的productName参数重命名导入的模块:

  • 在Package.swift中调整依赖配置:
    dependencies: [
        .package(url: "https://github.com/groue/GRDB.swift.git", from: "6.0.0"),
    ],
    targets: [
        .target(
            name: "YourAppTarget",
            dependencies: [
                .product(name: "GRDB", package: "GRDB.swift", productName: "MyGRDB"),
            ]
        ),
    ]
    
  • 代码中使用import MyGRDB替代原有的import GRDB,确保应用使用自身引入的版本而非系统框架。

3. 检查构建配置中的框架嵌入设置

  • 进入Xcode项目设置,选择目标应用,切换到「Build Phases」标签页,查看「Link Binary With Libraries」和「Embed Frameworks」部分,确认GRDB框架是否被重复嵌入或链接。
  • 确保GRDB仅通过SPM管理,没有手动添加的.framework文件。

4. 验证模拟器运行时完整性

  • 删除iOS 17模拟器运行后重新下载安装:打开Xcode → Settings → Platforms → 选中iOS 17 Beta → 点击「Remove」,之后重新下载最新的iOS 17模拟器运行时。
  • 创建新的iOS 17模拟器设备,排除现有设备配置问题。

5. 检查应用依赖链

  • 使用swift package show dependencies命令查看完整依赖树,确认是否有其他第三方库间接引入GRDB框架导致重复依赖。
  • 若存在间接依赖,指定统一的GRDB版本,避免不同版本冲突。

6. 提交GRDB官方Issue

若以上方法均无效,整理问题详情(Xcode版本、iOS版本、GRDB版本、报错日志)提交到GRDB的GitHub仓库Issue区,官方可能针对iOS 17新特性提供针对性修复方案。

内容的提问来源于stack exchange,提问作者Ian

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.19 03:35:33