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)
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
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.