将数据从 react-native 写入 Realm Object Server
Realm.Sync.User.login('https://xxxx-xxxx-xx.us1.cloud.realm.io/', 'xxxxx', 'xxxxxx')
.then((user) => {
const config = {
sync: {
user,
url: 'realms://xxxx-xxxx-xx.us1.cloud.realm.io/xxxx',
error: err => console.log(err),
partial: true,
},
schema: [{
name: 'one',
primaryKey: 'id',
properties: {
id: { type: 'int', indexed: true },
name: 'string',
},
}],
};
const realm = new Realm(config);
console.log(realm.path);
realm.write(() => {
realm.create('one', { id: 11, name: 'string' });
});
});
当我运行我的节点 postgres 适配器以将数据从 ROS 同步到 postgres 时,它失败说分段错误。找不到任何详细的日志。当我通过Realm studio写入 ROS 时,我可以将数据从 ROS 同步到 postgres,但是当我通过react native写入时不起作用。我能够从postgres 同步数据以通过 ROS 做出本机反应而不会出现问题。还可以通过realm studio查看数据写入ROS。
请参考这个问题Segmentation Fault syncing from React Native -> ROS -> Postgres