ios - Swift:如何注销保留对象数?

标签 ios iphone swift reference retain

有没有办法快速将对象的保留计数注销到 Xcode 的控制台? 如果不是,下一个最佳选择是什么?

最佳答案

使用CFGetRetainCount 函数

示例:

// `CFGetRetainCount` is only available in the `Foundation` module
import Foundation

print(CFGetRetainCount(object))

在这里阅读更多:https://developer.apple.com/reference/corefoundation/1521288-cfgetretaincount

希望有帮助

关于ios - Swift:如何注销保留对象数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28973115/

相关文章:

iPhone:如何让音乐为使用 OpenAL 的应用程序播放?

iphone - 如何在 ios 中将图像上传到 .ashx url

iphone - 适用于 iPhone/iPod Touch 的 HTML5 中的 Coverflow

swift - Wunderground API 的部分内容在 Swift 中无法访问

ios - 在 iOS8 中控制 iPhone 的 LED

iOS:如果已安装,则使用自定义 URL 打开应用程序,否则使用 iTunes

ios - CGContextSetShadowWithColor 将阴影放在转换阴影的文本之上

ios - 主 - 详细项目未按预期工作

ios - 如何使用快速代码在按钮单击中的自定义 UITableViewCell 中显示 UIAlertController?

ios - Alamofire swift4 无效的 URL