-
Notifications
You must be signed in to change notification settings - Fork 25
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
CFRunLoopPerformBlock never executes #531
Comments
@aquigriffin Could you add a short runnable sample to reproduce this issue? |
Even so, I prefer using GCD instead of run loops. It's much safer. No need to deal with run loop management and we can avoid issues like this. |
@ricardopereira Here is an example of my ClientOptions authCallback:
where _interaction startTaskOnSuccess is a call to our services for the token_request parameters. The client is being created on AppDelegate applicationDidLaunchWithOptions: with the following code: `- (void)configureClient {
}` If I force the callback(ARTTokenRequest *, NSError *) in clientOptions.authCallback to be run on the main thread, the callback will perform the block at line 180 in ARTHttp.m, and connect the client. If I am not running on main the block will not fire. There may be an issue with the connection retry happening before the callback can fire if not on the main thread, but I have not been able to verify this. I have verified I can repro this on device and simulator ios9.0+, iphone6/6s. |
@aquigriffin Thanks for the example. It makes sense what you said. The API reference makes this clear. It says that we shouldn't call the methods of an NSRunLoop object running in a different thread.
I will have a look into this. |
@aquigriffin Can you test it using |
Basically, if the problem is the
|
@ricardopereira I checked out fix-531 and tested connection with and without the auto-connect setting 'on'. I found I was getting an exception EXC_BAD_ACCESS on
Reading the description of dispatch_get_specific() says:
If we get NULL this would cause the error I'm seeing. You should check for null before checking equality. i.e.
That said, using this new code with my minor change does indeed ensure the authCallback's callback gets fired. |
@aquigriffin Damn 😅 I forgot the NULL case. I'll fix it right away. |
@aquigriffin Fixed. Try again please and don't forget the |
@ricardopereira works fine, thanks for the quick response. |
In ARTHttp.m, starting at line 175. CFRunLoopRef fails to perform block if CurrentRunLoopRef ignores wakeup. Reproduced with performing token request on application startup.
The text was updated successfully, but these errors were encountered: