Comments (1)
@moliya 由于C语言 static变量时在编译器处理的,所以MangoFix无法支持static变量,所以dispatch_once也无法支持,你可以通过其他方式实现该类似功能。dispatch_after和基本属性值丢失的问题,会在下一个版本修复。基本上属性值丢失问题,你现在可以把修饰符改为strong即可。对于dispatch_after你现在可以在MangoFix执行上下文中注入这个全局函数,如下代码
self.context[@"dispatch_after"] = [MFValue valueInstanceWithBlock:^(dispatch_time_t when, dispatch_queue_t _Nonnull queue, dispatch_block_t block){
dispatch_after(when, queue, block);
}];
调用代码如下:
- (void)testGCDAfterWithCompletionBlock:(Block)completion{
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 3 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
completion(@"success");
});
}
需要注意的是MangoFix不支持手动类型强转,所以3 * NSEC_PER_SEC不要手动转(int64_t)(3 * NSEC_PER_SEC),MangoFix会在运行时自动转换。
from mango.
Related Issues (20)
- 和jspatch除了dsl区别在哪里? HOT 3
- 关于 super 直接使用 objc_msgSendSuper 实现的问题
- demo had memory leaks
- frame或者bounds为null HOT 3
- 在模拟器上运行不起来
- 设置label.text或textField.text或textView.text,字符串长了就崩溃 HOT 1
- swift啥时候有计划呀 HOT 2
- 关于RSA加密的问题 HOT 3
- 审核能过吗
- 是否可以加个通过公钥加载补丁文件的方式 HOT 1
- 脚本带 if (xx && xx) 或 if (xx || xx) 时可能存在内存泄漏 HOT 1
- 子类的初始化方法中通过super调用父类的初始化方法,参数会变为nil,大家有遇到这个问题吗,或者应该怎么解决 HOT 3
- 大佬有提供mangofix的静态framework库么,我需要手动导入
- 关于类型转换的问题 HOT 1
- swift 调用原有方法只能是@objc修饰过的吗?
- 一个mg文件里可以放多个类么,还是说一个mg文件只能对应一个类的修复 HOT 1
- category可以吗?如何更新category的方法呢? HOT 1
- Terminating app due to uncaught exception 'MFRuntimeErrorNotFoundCFunction' HOT 2
- 支持NSObject+xxxx,基类扩展的hook吗?
- Grammar conflicts
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mango.