Objective-C Blocks, Recursion Fails

前端 未结 3 1259
说谎
说谎 2020-12-28 23:03

Sup guys,

I\'m trying to do a function that calls itself but by putting everything on one block,

As you can see, the following function is intended to be cal

3条回答
  •  渐次进展
    2020-12-28 23:48

    It works with XCode 5 - no warnings, no retain cycles:

    typedef void(^blockT)();
    
    blockT block1;
    blockT __block block1recursive;
    
    block1recursive = block1 = ^(){
        block1recursive();
    };
    
    block1();
    

提交回复
热议问题