使用Realm Mobile Platform时从iOS扩展程序访问Realm [英] Accessing Realm from an iOS Extension while using Realm Mobile Platform

查看:97
本文介绍了使用Realm Mobile Platform时从iOS扩展程序访问Realm的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从iOS扩展程序访问我的Realm,但是使用Realm Mobile Platform时,该领域路径不可用. 我已经收到来自领域的建议,以保留一个克隆副本并使其保持同步.如何实现呢? ...并且被认为是干净"的解决方案吗? (可能有多个领域)

解决方案

您应该像通常一样,通过使用适当的同步配置(指定用户和远程Realm URL)创建一个Realm配置,从扩展中打开同步的Realm./p>

这是当前唯一支持将同一个同步Realm与应用程序及其关联扩展一起使用的方法.根本原因是因为Realm的同步子系统不支持从多个进程同时访问相同的同步Realm文件.

I would like to access my Realm from an iOS extension however the realm path is unavailable when using the Realm Mobile Platform. I've received advice from realm to hold a cloned copy and keep it in sync. How can that be achieved? ...and is it considered a "clean" solution? (there could be multiple realms)

解决方案

You should just open the synced Realm from your extension by creating a Realm configuration with a proper sync configuration (specifying user and remote Realm URL), like usual.

This is the only currently supported way to use the same synced Realm with both an app and its associated extension(s). The underlying reason is because Realm's synchronization subsystem doesn't support accessing the same synced Realm file concurrently from multiple processes.

这篇关于使用Realm Mobile Platform时从iOS扩展程序访问Realm的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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