Magic Studio

专心做有逼格的APP!

2014年1月10日 #

How do I avoid capturing self in blocks when implementing an API?

摘要: Short answerInstead of accessingselfdirectly, you should access it indirectly, from a reference that will not be retained.If you're not using Automatic Reference Counting (ARC), you can do this:__block MyDataProcessor*dp = self;self.progressBlock =^(CGFloat percentComplete){[dp.delegate myAPI:dp 阅读全文

posted @ 2014-01-10 18:51 Mr 布鲁斯 阅读(317) 评论(0) 推荐(0) 编辑

导航