Closed 623637646 closed 3 years ago
@623637646 From what I can see it seems that issue lies within Timer itself. If you create timer with one of the convenience initialisers it works (do not crash). I believe that internals of timer are not correctly initialised (eg. isValid returns false).
Also keep in mind that: "Interception of messages sent to Core Foundation isn't supported".
I see. Thank you so much. @TLizer .
Do you have any more references about Interception of messages sent to Core Foundation isn't supported
?
Do you have any more references about
Interception of messages sent to Core Foundation isn't supported
?
Timer.description
is part of Timer and it is defined inside Foundation
framework and this means that you cannot intercept messages sent to such objects.
You can find more info in the associated error description: https://github.com/ReactiveX/RxSwift/blob/6ccd6719af8a86bf18c2239e231c0276fd861068/RxCocoa/Common/RxCocoaObjCRuntimeError%2BExtensions.swift
To make it short rx.sentMessage
won't work on Foundation objects directly.
Could you maybe describe what where you trying to achieve with this code snippet you posted?
Interesting that the validation that would throw .cantInterceptCoreFoundationTollFreeBridgedObjects is not hit
Could you maybe describe what where you trying to achieve with this code snippet you posted?
Hi, @TLizer This code is only for testing. I will not use it on live because Timer.init()
is not a formal way to init Timer. My concern is that RxSwift
should throw Error instead of crash (If we can do this).
About this conclusion Interception of messages sent to Core Foundation isn't supported
. Does Apple or other official documents say this? How do you know we can't intercept the object's method of Core Foundation?
Indeed the problem stems mainly from the fact that you are using Timer.init
which should not be used. Message interception doesn't always work, and I personally prefer crashing in these unexpected cases. Throwing makes sense for a "I can continue working" sort of runtime error, but crashing for something entirely unexpected.
Short description of the issue:
EXC_BAD_ACCESS Crash
Expected outcome:
No crash
What actually happens:
Crash
Self contained code example that reproduces the issue:
RxSwift/RxCocoa/RxBlocking/RxTest version/commit
RxCocoa (5.1.1) RxRelay (5.1.1) RxSwift (5.1.1)
Platform/Environment
How easy is to reproduce? (chances of successful reproduce after running the self contained code)
Xcode version:
:warning: Fields below are optional for general issues or in case those questions aren't related to your issue, but filling them out will increase the chances of getting your issue resolved. :warning:
Installation method:
I have multiple versions of Xcode installed: (so we can know if this is a potential cause of your issue)
Level of RxSwift knowledge: (this is so we can understand your level of knowledge and formulate the response in an appropriate manner)