麻烦必须在主线程上吗? [英] Swizzling have to be on main thread?
问题描述
在主线程上,我成功冻结了imageNamed:
方法.
I am succesfully swizziling imageNamed:
method when on the main thread.
这是我的代码,它是js-ctypes: https://gist.github.com/Noitidart /e8105a5f702dc9e6a4b8
Here is my code, it is js-ctypes: https://gist.github.com/Noitidart/e8105a5f702dc9e6a4b8
从另一个线程执行该操作时,我似乎崩溃了.我不确定这是否是拼写错误,我仍在挖掘,但似乎找不到任何错误.所以我想知道使用method_setImplementation
滚动是否不是线程安全的?
I seem to be crashing when doing it from another thread. I'm not sure if it's a typo somwhere, I'm still digging but can't seem to find any mistakes. So I was wondering if swizziling with method_setImplementation
is not thread safe?
相同的线程安全性适用于使用method_exchangeImplementations
滚动吗?
Does the same thread safety apply to swizziling with method_exchangeImplementations
?
推荐答案
我认为您的代码中存在问题,但我可以向您推荐JRSwizzle库 https://github.com/rentzsch/jrswizzle 和演示如何使用: https://github.com/kostiakoval/JRSwizzleExample
I think you have an issue in your code but I can recommend you JRSwizzle library https://github.com/rentzsch/jrswizzle and a demo how to use: https://github.com/kostiakoval/JRSwizzleExample
这篇关于麻烦必须在主线程上吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!