Accessing Realm from an iOS Extension while using

2019-09-16 13:57发布

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条回答
Juvenile、少年°
2楼-- · 2019-09-16 14:19

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.

查看更多
登录 后发表回答