ios - 在 Swift 中释放对象

标签 ios swift

我是 Swift 的新手,想知道是否有人可以帮助确认我对在 Apple 的 Swift 中释放对象的理解?

CGPathCreateWithRect() 的文档描述了 here说明返回值为

"A new, immutable path. You are responsible for releasing this object."

什么时候说“你负责”是不是就像说当你不再拥有一个引用时垃圾收集器将删除该对象一样简单? IE。您负责管理引用资料?在这种情况下 - 这不是很明显吗?如果不是 - 这是什么意思?

谢谢

拜伦

最佳答案

只有在使用 Objective-C 时,您才有责任

来自Swift documentation

Memory Managed Objects

Core Foundation objects returned from annotated APIs are automatically memory managed in Swift—you do not need to invoke the CFRetain, CFRelease, or CFAutorelease functions yourself.

关于ios - 在 Swift 中释放对象,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34673900/

相关文章:

ios - 创建一个每 24 小时运行一次的事件?

ios - 尝试使用 JSON 从 Web 服务获取响应时发生错误

ios - 如何为 (^Something) block 创建 MonoTouch 绑定(bind)?

ios - Chartboost 插页式 : "not in the window hierarchy!" warning

iOS 6 - 某些 View 的导航 Controller 横向旋转,而其他 View 仅纵向

swift - 如何在 MacOS 中正确显示 xib 文件的模态视图?

iOS:多行 UILabel 与水平 UIStackView 中的另一个 UILabel 的大小错误

ios - 将 JSON 数据发布到现有对象中

ios - Swift tableView 委托(delegate)方法未被调用

ios - ARKit 平面,上面有现实世界的物体