Capturing a variable in a Block when the Block is in the initializer

后端 未结 3 1416
广开言路
广开言路 2021-01-05 04:45

Consider this:

id observer = [[NSNotificationCenter defaultCenter] 
    addObserverForName:MyNotification 
                object:nil 
              


        
3条回答
  •  太阳男子
    2021-01-05 05:13

    yes, I think declaring observer beforehand as __block id observer; should work.

提交回复
热议问题