Open LeoNatan opened 5 years ago
We could actually implement those methods in NSBlock
category, and the reason why we use the runtime API to add them dynamically is because we want to be cautious if there is a conflict and fail early.
One quick fix (probably the best fix) is, instead having a constructor, move the code into here using dispatch_once
.
Do you want to try it out?
Unfortunately, I have opted to implement an IPC solution of my own for our project with the needs of asynchronicity. I may be able to test in the future, but not right now.
Kk, I'll send a quick fix in next few days then.
Kk, I'll send a quick fix in next few days then.
Ummm... hi! I'd love to get that fix!
As discussed in #156, it seems that blocks cannot be properly serialized to remote objects, when attempting a remote method call in a
+load
method, due to load order woes.The code linked in the other issue shows that
__attribute__((constructor))
is used, which is ordered later in the start chaing, after+load
methods.Moving the code to
+load
is also not the best solution, as+load
are also subject to call order issues, as I recently discovered. I've settled on nasty hacks in my case. But those hacks aren't suitable here, as the code is in a class category.The result is that when a block is called from the remote process, it is not serialized correctly on the client side (because the above-linked code has not executed yet), and an exception is raised
+[NSInvocation _invocationWithMethodSignature:frame:]: method signature argument cannot be nil
in: