New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UIScheduler not working as expected #2635
Comments
I've created a minimal sample project demonstrating my issue: http://www.komendera.com/bugs/rac/UISchedulerTest.zip |
The problem seems to be that I found this tweet, which might be related?: |
Main queue and main thread are the same thing. The optimization that you linked to regarding scheduling is an implementation detail, but regardless, both will be invoked on the same thread. What's the crash exactly? The bad access seems to indicate that something else is at play here. I'm AFK right now but I can test the sample project when I get home :) |
I thought so too. Here's a simple Playground demonstrating the issue without ReactiveCocoa: The crash log from the Playground looks like this (the framework stack trace is the same for the crashes with RAC):
|
I ran into the same problem, I was trying to scroll a collection view programmatically and the scroll was not happening. I tried dispatching async to main and that fixed the problem for me. I created another version of ate UISchedular that always dispatches async to main. This probably has other implications that I am unaware of but it solved the problem for me right now.
|
That is |
Yes, I suppose there's no way of knowing beforehand weither |
@ikesyo Thanks for the tip, will use that instead 👍🏼 |
@NachoSoto I contacted Apple DTS, they confirmed it is a bug in MapKit. But they also cautioned that the pattern of They also explicitly stated that main queue and the main thread are not the same thing, but are have subtle differences, as shown in my demo app. |
For what its worth, I dug into what's the issue in my example:
|
Hello, I've run in to the same issue. Can I help fixing it ? |
We want to avoid a scheduler hop. That adds a delay that can have unfortunate side effects, and it makes debugging much more difficult. I'm not sure there's anything we can do about this. You may just need to use the main queue scheduler in some instances. |
I've just submitted a PR for this: #2912. Could you try that branch and confirm whether the fix works as expected? @kommen @laptobbe @adriantofan |
With RAC4 rc1
.observeOn(UIScheduler())
doesn't work as expected for me (I didn't test older versions though):currentRoute
is set from the callback inMKDirections calculateDirectionsWithCompletionHandler
. When I wrap theaddOverlay
call into adispatch_async(dispatch_get_main_queue()
, as shown in the commented version, it works as expected and doesn't crash.Any hints on what I'm doing wrong?
The text was updated successfully, but these errors were encountered: