I've got an app (only ios5) that inside a method declares a weak variable used inside a block to reference an instance of a view controller.
QRCodeViewController * __weak weakSelf = self;
The problem is that the compiler shows a warning saying:
__weak attribute cannot be specified on an automatic variable
In that application I've used a lot weak references and I never saw a warning like that, the only difference from the other classes is that this class is implemented in a .mm file since it uses a c++ object and project can't compile if I leave it as a .m.
I must say that the code seems to work fine.
Any suggestion?
Facing this same warning, I make it disappear using a __block attribute the following way :
__block __weak MyViewController* weakSelf = self;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With