10.13 SDK: CBManagerState is impossible to use without warnings

Originator:thakis
Number:rdar://33375728 Date Originated:2017 Jul 17
Status:new Resolved:
Product:macOS + SDK Product Version:
Classification: Reproducible:
 
Summary:
CBCentralManagerState is being replaced with CBManagerState in 10.13. The two enums are different types, but the entries have the same values. CBManagerState is marked 10.13+. We (chrome) can't use the new version without warnings because it's marked 10.13+, and we can't use the old version because then we get warnings because [CBManager state] now returns a CBManagerState, so comparing against the old constants results in a warning.

Steps to Reproduce:
Try to write code that compares the result of [CBManager state] to either CBManagerStateResetting or CBCentralManagerStateResetting with the 10.13 SDK in a way that no warning is produced, and in a way that runs on 10.10.

Expected Results:
It's possible somehow.

Observed Results:
If we use CBManagerStateResetting, then clang tells us to use it in @available(macos 10.13, *) (which isn't good because this code runs on 10.10+ without issues), but if we use CBCentralManagerStateResetting then we get a warning that [CBManager state] returns a CBManagerState which is a different type than CBCentralManagerState

Version:
Xcode 9 beta, macOS 10.13 SDK

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!