主键属性“名称"在对象"RealmSwiftPermissionRole"上不存在 [英] Primary key property 'name' does not exist on object 'RealmSwiftPermissionRole'

查看:167
本文介绍了主键属性“名称"在对象"RealmSwiftPermissionRole"上不存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的swift项目中使用RealmSwift作为数据库.今天,在Xcode-beta版本11中打开我的项目后,我的应用因以下错误而崩溃:

I'm using RealmSwift as a database in my swift project. Today, after opening my project in Xcode-beta version 11, my app crash with this error:

由于未捕获的异常"RLMException"而终止应用程序,原因:对象"RealmSwiftPermissionRole"上不存在主键属性"名称"

Terminating app due to uncaught exception 'RLMException', reason: 'Primary key property 'name' does not exist on object 'RealmSwiftPermissionRole''

我的应用程序在Xcode(10.2.1)的早期版本上可以正常运行. RealmSwiftPermissionRole Realm 中的一类,我无权访问.也许在他们的功能更新中,他们修复了此错误,但就目前而言,我进行了很多搜索,但未找到任何解决方案. (我清理了该项目,从模拟器中删除了该应用程序,然后再次运行了该项目,但未做任何更改.) 有什么建议吗?

My app works properly on the previous version of Xcode(10.2.1). RealmSwiftPermissionRole is a class from the Realm and I don't have access to it. Maybe in their feature updates, they fix this bug but for now, I search a lot but didn't find any solution. (I clean the project, delete the app from the simulator, and run the project again but nothing changed.) Any suggestion?

推荐答案

iOS 13和Xcode 11存在问题,可能会导致此问题.设置了默认String值的Realm类的所有String属性都被忽略了. 您可以通过更新到最新版本(当前为3.20.0),然后在Xcode上解决此问题:产品->清洁生成文件夹.

There's an issue with iOS 13 and Xcode 11 which may cause this problem. All String properties of Realm classes with a default String value set are disregarded somehow. You can fix this by updating to the latest version (currently 3.20.0) and then on Xcode: Product -> Clean Build Folder.

如果您使用的是可可豆:

If you're using cocoa-pods:

打开项目的Podfile,并将RealmSwift行替换为:

Open your project's Podfile, and replace RealmSwift line with:

pod 'RealmSwift', '~> 3.20.0'

然后,打开项目文件夹中的终端,然后:

Then, open terminal on the project's folder and:

pod repo update
pod install

希望有帮助.

这篇关于主键属性“名称"在对象"RealmSwiftPermissionRole"上不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆