Uploaded image for project: 'Swift'
  1. Swift
  2. SR-6637

Deprecation warnings from Clang-imported enums with deprecated cases



    • Type: Bug
    • Status: Resolved
    • Priority: Medium
    • Resolution: Done
    • Component/s: Compiler
    • Labels:
    • Environment:


      When you build an iOS app in Xcode 9.0-9.2 (with Deployment Target set to iOS 11.0 or higher) and reference the LAError type from the LocalAuthentication framework in any way, you'll get the following three deprecation warnings in the build log:

      <unknown>:0: warning: 'touchIDLockout' was deprecated in iOS 11.0: use LAErrorBiometryLockout
      <unknown>:0: warning: 'touchIDNotEnrolled' was deprecated in iOS 11.0: use LAErrorBiometryNotEnrolled
      <unknown>:0: warning: 'touchIDNotAvailable' was deprecated in iOS 11.0: use LAErrorBiometryNotAvailable

      These warnings are not attached to any particular source line because I believe they are triggered by code in the Apple headers or the generated interface by the Clang importer.

      The root of the problem seems to be that iOS 11 introduced new names for these three enum cases: touchIDLockout became biometryLockout, and so on. The old names are marked as deprecated, and the new cases have the same integer values as the old ones.

      It looks like the Clang importer can't handle this complicated situation without emitting the deprecation warnings, and I'm wondering if there's anything we can do about it or if we have to live with it.

      For more information and background research, please check out this excellent Stack Overflow answer by Martin R's, where we discussed the same problem. The answer also mentions this related swift-users thread.

      I also filed Radar 36028653, which includes a minimal Xcode project to reproduce this. The same project is attached here. I decided to also file the bug here because the more I think about it, the more I've become convinced that this isn't an issue with the LocalAuthentication framework.

      It looks more like a problem in the Clang Importer that isn't specific to one particular framework. I'm not sure the maintainers of the LocalAuthentication framework can do anything to get rid of these warnings.

      I'm currently working on a project where we try really hard to maintain a "zero warnings" build. Having this issue is therefore quite annoying.


          Issue Links



              Unassigned Unassigned
              ole Ole Begemann
              8 Vote for this issue
              13 Start watching this issue