Home > OS >  quantityType(forIdentifier:) deprecated in a future version of iOS?
quantityType(forIdentifier:) deprecated in a future version of iOS?

Time:12-05

Xcode (I'm on v13.1) warns me, that quantityType(forIdentifier:) will be deprecated in a future version of iOS.

enter image description here

I thus checked in Apple's developer documentation for a hint what else to use. Surprisingly, on the documentation it is not labeled as deprecated in near future.

Which source to trust in this case? And in case quantityType(forIdentifier:) is indeed to be removed in teh future, is there already a known replacement?

CodePudding user response:

The code completion dialog is merely reporting what you could see for yourself if you looked at the same header that it is looking at:

@available(iOS, introduced: 8.0, deprecated: 100000)
open class func quantityType(forIdentifier identifier: HKQuantityTypeIdentifier) -> HKQuantityType?

100000 means "the unknown future". There's no rush; it's only a warning.

But you might as well start updating your code now. The replacement will be this initializer:

https://developer.apple.com/documentation/healthkit/hkquantitytype/3778608-init

  • Related