“'deinitialize()' 已弃用:deinitialize(count:) 的默认参数已被删除” Xcode 中的警告

"'deinitialize()' is deprecated: the default argument to deinitialize(count:) has been removed" warning in Xcode

我正在尝试使用以下代码取消初始化 UnsafeMutablePointer

pointer.deinitialize()

这之前工作得很好,但是 Xcode 9.3 给我一个警告:

'deinitialize()' is deprecated: the default argument to deinitialize(count:) has been removed, please specify the count explicitly

我应该怎么做?

您应该明确提供 count 参数 - 它应该是您要取消初始化的值的计数

来自Apple Developer Documentation

deinitialize(count:)

Deinitializes the specified number of values starting at this pointer.

Parameters

count

The number of instances to deinitialize. count must not be negative.