以后可以在领域中更改主键吗? [英] Is it possible in realm to change the primary key later..?

查看:63
本文介绍了以后可以在领域中更改主键吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在本地设置了一个临时主键,然后将对象保存到域中,然后服务器为该对象分配了唯一键,然后我想为该对象更新主键.

I set a temporary primary locally and save the object to realm, and later the server assigns a unique key for the object and then I want to update the primary key for the object.

那么可以重新分配对象的主键吗?当我们为对象重新分配主键时会发生什么?它将使用旧的主键保存对象吗?

So is it possible to reassign a primary key for the object? And what happens when we reassign a primary key to the object? Will it save the object with the old primary key?

推荐答案

可以将主键的值更改为Realm 1.2.0.

It is possible to change the value of a primary key up to Realm 1.2.0.

从Realm 2.0.x开始,禁止更改主键值.

It is prohibited to change primary key value since Realm 2.0.x.

这篇关于以后可以在领域中更改主键吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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