Open smolskyaleksey opened 8 years ago
I will look at your test project but you can't comment this code out and expect RBQFRC to work. What is going is that you cannot add a Realm notification block to a thread that doesn't have a run loop. This means background threads via a dispatch queue will not support Realm notifications unless you start a run loop on that thread. This code starts a run loop on the background thread and then registers a notification block so that RBQFRC can process all changes from Realm on a background thread.
YES, you absolutely is right . I don't use background thread and i think you should check if it call on main thread,because when I call it on main thread it stops working.
Can we use something like this for main theard
// Setup run loop
if (!self.notificationRunLoop) {
dispatch_semaphore_t sem = dispatch_semaphore_create(0);
if (![NSThread isMainThread]) {
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
CFRunLoopPerformBlock(CFRunLoopGetCurrent(), kCFRunLoopDefaultMode, ^{
weakSelf.notificationRunLoop = [NSRunLoop currentRunLoop];
dispatch_semaphore_signal(sem);
});
CFRunLoopRun();
});
} else {
weakSelf.notificationRunLoop = [NSRunLoop currentRunLoop];
dispatch_semaphore_signal(sem);
}
dispatch_semaphore_wait(sem, DISPATCH_TIME_FOREVER);
}
but it still does not release delegate for bg thread
Steps to reproduce: 1) run app 2)press button "Press me' 3) Press plus button on top right corner 4)press back button
Act: Delegate don't release Exp: Delegate should be released
Do you have some news?
testbatch.zip Hi everyone
Could you explain why do you use here manipulation with runloop. Now we have problem that delegate doesn't release and we have strong link. If i comment all code with runloop, it will work fine. Could you fix it or delete this strange code because RBQRealmNotificationManager not used in this project. Also i provided project with it. It's very easy to reproduce.