ios - swift Realm : creating instance of Realm throws NSException

标签 ios swift realm

OSX 10.11,  Swift 2.2, Realm 0.99

我已经使用 Carthage 安装了 Realm。

let realm = try! Realm() 抛出一个 NSException:

libc++abi.dylib:以 NSException 类型的未捕获异常终止

项目编译、构建并运行,直到 Realm 实例化。 两个 Realm 框架文件都在项目的嵌入式二进制文件和嵌入式框架中。 它们位于 Carthage/Build/IOS 文件夹中。 它们还出现在构建阶段的带库部分的链接二进制文件中。

非常感谢您的帮助。

Realm 安装:

Install Carthage 0.9.2 or later.
Add github "realm/realm-cocoa" to your Cartfile.
Run carthage update.

Drag RealmSwift.framework and Realm.framework from the appropriate platform directory in Carthage/Build/ to the “Embedded Binaries” section of your Xcode project’s “General” settings.

iOS/watchOS/tvOS: On your application targets’ “Build Phases” settings tab, click the “+” icon and choose “New Run Script Phase”. 
Create a Run Script with the following contents:

/usr/local/bin/carthage copy-frameworks

and add the paths to the frameworks you want to use under “Input Files”, e.g.:

$(SRCROOT)/Carthage/Build/iOS/Realm.framework

$(SRCROOT)/Carthage/Build/iOS/RealmSwift.framework*  

最佳答案

哦,亲爱的,问题是类中的非可选声明。 不知为什么那不能被捕获。完全是浪费时间。

关于ios - swift Realm : creating instance of Realm throws NSException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36822298/

相关文章:

ios - Xcode10运行模拟器警告启动失败

Objective-C修饰符问题

ios - 在 iPhone 应用程序中存储 "total number of time spent"的值

swift - 通话中的额外参数?

ios - swift:将存储属性用作计算属性是正确的

ios - 更新具有主键的 Realm 对象

security - 如何保护 REST 资源,以便只有角色的单个用户可以访问它?

ios - 通过 Facebook iOS SDK 邀请好友时 NSURL *resultURL 是什么?

ios - 滚动时更改按钮的 alpha

swift - Realm DB 是否优化了未更改的数据集上的过滤器计算?