Giter Site home page Giter Site logo

有几个问题 about mango HOT 1 CLOSED

moliya avatar moliya commented on September 26, 2024
有几个问题

from mango.

Comments (1)

YPLiang19 avatar YPLiang19 commented on September 26, 2024 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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.