RLMException thrown by realm
wallacesky opened this issue · 2 comments
wallacesky commented
Situation
Step of crash:
- Fresh install
- Fetch a list of
SKYConversation
by callingchatExtension.fetchConversations(...)
- Initialize
SKYChatConversationViewController
and assign theSKYConverstaion
instance
let vc = SKYChatConversationViewController()
vc.conversation = conversation // conversation object create from chat sdk
self.navigationController?.pushViewController(vc, animated: true)
- Push the view controller which leads to app crash, exception logs is provided below
*** Terminating app due to uncaught exception 'RLMException', reason: 'Realm accessed from incorrect thread.'
*** First throw call stack:
(0x181a761c0 0x1804b055c 0x10331834c 0x103219e28 0x1032198e0 0x103207664 0x103e3e074 0x103e3da24 0x103e43874 0x103e9901c 0x103e99344 0x103e7a390 0x103e7a568 0x1878e7ee4 0x1878e7c5c 0x187a70190 0x187988858 0x1879884c0 0x187988424 0x1878cd220 0x184d8d188 0x184d81e64 0x184d81d24 0x184cfe7ec 0x184d25c58 0x1878c28f0 0x181a237dc 0x181a2140c 0x181a2189c 0x181950048 0x1833d6198 0x18793b2fc 0x187936034 0x1000b0338 0x1809345b8)
libc++abi.dylib: terminating with uncaught exception of type NSException
However, the next app launch and rerun from step 2 to 4. Everything is going alright without any errors.
connects #166
ben181231 commented
I cannot reproduce using the provided steps. I have verified:
- It works when directly initiating a
SKYChatConversationViewController
and push it.
let vc = SKYChatConversationViewController()
vc.conversation = conversation
self.navigationController?.pushViewController(vc, animated: true)
- The fetch API (
skygear.chatExtension.fetchConversations(...)
) involves the callback in main thread.
wallacesky commented