因此,我正在努力追踪为什么Realm db无法可靠地从iOS共享扩展中写入。我希望能够从扩展中更新我的领域数据库,然后允许我的包含应用程序在扩展完成后重新加载数据库。它保持相当小,因为我做的大部分工作都保留在cloudkit中。我使用realm作为UI数据的一种索引。
有没有办法让我的包含应用程序的Realm实例无效,关闭或释放,以便我的扩展可以安全地写入?我正在考虑这样做"关闭"数据库中的数据库" applicationBecameInactive"
那会有用吗?
它有时会起作用,因为我现在已经设置了它,大多数情况下,它有时会转储......
这是转储的编辑版本,当失败时......
alloc_slab.cpp:494: [realm-core-0.94.0] Assertion failed: cfg.session_initiator || !cfg.is_shared [0, 0]
0 Realm 0x00335787 _ZN5realm4util18terminate_internalERNSt3__118basic_stringstreamIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE + 86
1 Realm 0x0045e8a3 _ZN5realm4util9terminateIbJbEEEvPKcS3_lT_DpT0_ + 602
2 Realm 0x0033806d _ZN5realm9SlabAlloc11attach_fileERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEERNS0_6ConfigE + 2056
3 Realm 0x003e2ec9 _ZN5realm11SharedGroup9do_open_2ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS0_15DurabilityLevelEbPKc + 832
4 Realm 0x003e2a33 _ZN5realm11SharedGroup9do_open_1ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEbNS0_15DurabilityLevelEbPKcb + 46
5 Realm 0x003206dd _ZNSt3__113__vector_baseIPN5realm5TableENS_9allocatorIS3_EEED2Ev + 640
6 Realm 0x0031a199 RLMRealmAddPathSettingsToConfiguration + 2136
7 Realm 0x0031b303 RLMRealmAddPathSettingsToConfiguration + 6594
8 RealmSwift 0x0056eee8 _TFC10RealmSwift5RealmCfMS0_FzT13configurationVS0_13Configuration_S0_ + 904
9 SaveToTioga 0x00113260 SaveToTioga + 156256
10 SaveToTioga 0x001135d0 SaveToTioga + 157136
11 SaveToTioga 0x00113914 SaveToTioga + 157972
12 SaveToTioga 0x00105bf4 SaveToTioga + 101364
13 libswiftObjectiveC.dylib 0x00ab1a0c _TF10ObjectiveC15autoreleasepoolFFT_T_T_ + 40
14 SaveToTioga 0x00105078 SaveToTioga + 98424
15 SaveToTioga 0x001024f8 SaveToTioga + 87288
16 SaveToTioga 0x0013a1e0 SaveToTioga + 315872
17 SaveToTioga 0x00132760 SaveToTioga + 284512
18 SaveToTioga 0x001035dc SaveToTioga + 91612
19 libdispatch.dylib 0x38f13e2f <redacted> + 10
20 libdispatch.dylib 0x38f13e1b <redacted> + 22
21 libdispatch.dylib 0x38f186c9 _dispatch_main_queue_callback_4CF + 1532
22 CoreFoundation 0x26d6c535 <redacted> + 8
23 CoreFoundation 0x26d6aa2f <redacted> + 1590
24 CoreFoundation 0x26cbd0d9 CFRunLoopRunSpecific + 516
25 CoreFoundation 0x26cbcecd CFRunLoopRunInMode + 108
26 GraphicsServices 0x2fea4af9 GSEventRunModal + 160
27 UIKit 0x2af462dd UIApplicationMain + 144
28 libxpc.dylib 0x390d01db <redacted> + 706
29 libxpc.dylib 0x390d1855 xpc_main + 168
30 Foundation 0x27c56c51 <redacted> + 0
31 PlugInKit 0x32a3e181 <redacted> + 508
32 PlugInKit 0x32a3de4f <redacted> + 58
33 PlugInKit 0x32a3e1b5 <redacted> + 20
34 libextension.dylib 0x3813f7cd NSExtensionMain + 48
35 libdyld.dylib 0x38f3c873 <redacted> + 2
IMPORTANT: if you see this error, please send this log to help@realm.io.
答案 0 :(得分:0)
您应该能够立即从多个进程访问数据库,有一些机制可以确保正确处理。因此,没有必要关闭数据库,这只能通过确保您不保留任何RLMRealm
,RLMObject
和RLMResults
实例来实现。
你在这里点击了一个crash,之前已在评论中联系过,最近引起了我们的注意,我们仍在积极调查我们可以同时修复并随附版本0.96.3。