len*_*nny 8 deprecated deprecation-warning swift healthkit apple-documentation
Xcode(我使用的是 v13.1)警告我,这quantityType(forIdentifier:)将在 iOS 的未来版本中被弃用。
因此,我检查了苹果的开发人员文档,以获取还可以使用什么的提示。令人惊讶的是,在文档中它并没有被标记为在不久的将来已弃用。
在这种情况下应该相信哪个消息来源?如果quantityType(forIdentifier:)将来确实要删除,是否已经有已知的替代品?
mat*_*att 10
代码完成对话框只是报告您可以看到的内容,如果您查看它正在查看的相同标头:
@available(iOS, introduced: 8.0, deprecated: 100000)
open class func quantityType(forIdentifier identifier: HKQuantityTypeIdentifier) -> HKQuantityType?
Run Code Online (Sandbox Code Playgroud)
100000意思是“未知的未来”。不着急;这只是一个警告。
但您不妨现在就开始更新您的代码。替换将是这个初始化程序:
https://developer.apple.com/documentation/healthkit/hkquantitytype/3778608-init
@available(iOS, introduced: 8.0, deprecated: 100000)
open class func quantityType(forIdentifier identifier: HKQuantityTypeIdentifier) -> HKQuantityType?
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
967 次 |
| 最近记录: |