ios - "Use of unresolved identifier ' Realm '"

标签 ios xcode swift realm carthage

我使用 Carthage 在我的 iOS 应用程序目标上安装了 Realm(我确保我将它添加到嵌入式二进制文件部分,设置框架搜索路径,并设置 copy-frameworks 构建阶段)。我还有一个 import RealmSwift在我使用它的每个文件的顶部声明。

尽管如此,在我引用 Realm 或 Realm 类型的任何地方我仍然会收到错误:"Use of unresolved identifier 'Realm'""Use of unresolved identifier '<a realm type>'" .

奇怪的是我的应用程序构建和运行没有任何问题;错误会在应用程序运行时消失,并在应用程序未运行时重新出现。

我已经尝试过的事情:选择“产品”>“清理”,删除派生数据,重新启动 Xcode,然后重新启动计算机——没有任何效果。

"Use of unresolved identifier 'Realm'" error in Xcode

提前致谢。

最佳答案

这是由于 rdar://23551273 ,这会影响使用预编译框架进行调试。 Carthage issue #924 中也详细讨论了它.

我建议您使用 carthage update --no-use-binaries 来解决这个问题。

关于ios - "Use of unresolved identifier ' Realm '",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37930123/

相关文章:

XCode 调试 - 我可以绕过反汇编代码的单步执行吗

ios - UIAlertAction 值列表

ios - AVCaptureSession、AVCaptureAudioDataOutput 和背景音乐

ios - 为什么无法处理 APNS 推送通知和本地通知?

ios - 有没有办法更改 UILocalNotification 的时间之前的文本?

iphone - 多行标签文本对齐

xcode - Mac OSX : how to know if app automatically launched at session startup/login?

ios - 将容器 View Controller 嵌套在另一个容器 View Controller 中

ios - 如何在 Swift 5 中使用 Alamofire 解析 json

Swift 4 - UIProgressView 作为 UIView 出现