首页 > 其他 > 详细

block 中循环引用的问题

时间:2015-06-18 13:41:47      阅读:199      评论:0      收藏:0      [点我收藏+]

#pragma mark -- 循环引用 //----------------------------------------------------------------------------------------------------

/*

    某些block中,使用self会造成循环引用


    __weak AppDelegate *weakSelf = self;

    dispatch_async(mainQueue, ^(void) {

        AppDelegate *strongSelf = weakSelf;

        if (strongSelf != nil){

            [strongSelf.myTimer invalidate];

            [[UIApplication sharedApplication] endBackgroundTask:self.backgroundTaskIdentifier];

            strongSelf.backgroundTaskIdentifier = UIBackgroundTaskInvalid;

        }

    });


    __unsafe_unretained contentsViewController* yqContentsViewController = self;

    [_threeView reminderBlock:^{

        [_alertView setMessage:@"本章节内容暂时为空"];

        [_alertView show];

        [NSTimer scheduledTimerWithTimeInterval:1.0f target:yqContentsViewController selector:@selector(alertDismissed) userInfo:nil repeats:NO];

    }];

 */


block 中循环引用的问题

原文:http://blog.csdn.net/ios14311034/article/details/46545795

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!