Swift 2:IBOutlet Collection [UIButton]!泄漏记忆 [英] Swift 2 :IBOutlet Collection [UIButton]! leaks memory

查看:166
本文介绍了Swift 2:IBOutlet Collection [UIButton]!泄漏记忆的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近在我的应用程序中,我发现我的UIButton插座系列正在泄漏内存。

Recently in my app I have found out that my UIButton outlet collection is leaking memory.

我所拥有的只是

    @IBOutlet var TabBarButtons: [UIButton]!

来自Instrument

And from Instrument

谁能告诉我出了什么问题?随着时间的推移,NSArray中的变量数量不断增长,我所拥有的是一个包含4个UIButton的数组。

Can anyone tell me what's gone wrong? As time goes on, the amount of variables in the NSArray keeps growing and all I have is an array with 4 UIButtons from IB.

推荐答案

这是一个错误。参考 rdar:// 24272775

解决方法现在是取代[UIButton]!与NSArray!并在以后使用时将其内容转换为UIButton。

Workaround for now is to replace [UIButton]! with NSArray! and cast its contents to UIButton later when used.

这篇关于Swift 2:IBOutlet Collection [UIButton]!泄漏记忆的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆