2

Just installed the latest XCode version which provided some changes in AVCapturePhotoOutput class, I wonder how to fetch the list of support flash modes. In the previous version, I used supportedFlashModes property which is no more available

open var __supportedFlashModes: [NSNumber] { get }
mbutan
  • 1,359
  • 2
  • 13
  • 23

2 Answers2

2

I guess new Swiftified supportedFlashModes property is planned but not yet completed in beta 5.

open var supportedFlashModes: [AVCaptureDevice.FlashMode] { get }

Until the day my guess will be confirmed (can be negative), you can use __supportedFlashModes. It's not removed, just renamed.

(Some betas contain this sort of under-construction renaming.)

You should better send a bug report to keep Apple aware of this issue.


EDIT Seems iOS 11 SDK/Xcode 9.1 has fixed this issue and the Release Notes of Xcode 9.1 beta say:

  • The following AVFoundation API are now available:
    • AVCaptureDevice.Format.supportedColorSpaces
    • AVCaptureDevice.supportedFlashModes
    • AVCapturePhotoOutput.availablePhotoPixelFormatTypes
    • AVCapturePhotoOutput.availableRawPhotoPixelFormatTypes
    • AVCapturePhotoSettings.availablePreviewPhotoPixelFormatTypes

Code which was previously modified to use a double underscore as a workaround should be modified to use these public symbols or the app may be rejected by the App Store.

(Bold style added.)

OOPer
  • 47,149
  • 6
  • 107
  • 142
  • @AshleyMills, unfortunately true. And I cannot find any Swiftified alternatives for such `__`-leaded properties. ([Apple's reference page](https://developer.apple.com/documentation/avfoundation/avcapturephotooutput/1648766-supportedflashmodes) lacks Swift version of such properties. Hope Apple's review team would not take this as using private APIs, but not confirmed. – OOPer Sep 13 '17 at 20:57
  • Apple has confirmed the mistake and use of `__xx` API instead. See here: https://forums.developer.apple.com/thread/86810 – Shai Ben-Tovim Sep 25 '17 at 09:05
  • @ShaiBen-Tovim, thanks for the nice link. Happy to see that Apple's engineer has confirmed. – OOPer Sep 25 '17 at 18:16
0

Apple camera dev team confirms the Swift version of the API was inadvertently left out of Xcode 9 release. Until fixed have to use __supportedFlashModes

See here: https://forums.developer.apple.com/thread/86810 BTW some other AVFoundation APIs also affected.

Shai Ben-Tovim
  • 892
  • 8
  • 20