简体   繁体   中英

Is there a modernized way of getting a weak self reference for blocks?

I see old sample code use this code a lot:

__unsafe_unretained __block AssetItem *weakSelf = (AssetItem *)self;

I remember that something has changed and this became easier. So is there now a modernized way of doing this?

__weak typeof(self) weakSelf = self;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM