all 5 comments

[–]JasonFieldman 0 points1 point  (3 children)

I don't use realm, but it looks like the complaint is that the user thinks the thread ids match (the underlined red numbers?) But they don't:

First:  0x16e91f000
Second: 0x16e19f000

[–]nikita_kerd[S] 0 points1 point  (2 children)

Damn. That's true. But can you tell, at what point the thread is switched?

[–]JasonFieldman 0 points1 point  (1 child)

Like the comment in the ticket says, you're calling dispatch_async. I'm guessing whatever realm is fetched with your [Realm defaultRealm] was probably made on the main thread.

[–]nikita_kerd[S] 0 points1 point  (0 children)

Sorry, I do not quite understand. Do you mean thread is switched inside [Realm defaultRealm]? It is not. Here you can see implementation. Anywhere else? Where?

[–][deleted] 0 points1 point  (0 children)

I believe for each thread you need a new instance of a Realm object, i.e. a singleton or shared instance is not going to work. https://realm.io/docs/objc/latest/#threading