Undefined symbols for supportedFlashModes in AVCapturePhotoOutput

Good Morning,


in the Xcode9 Golden Master it seems that `supportedFlashMode` is missing for AVCapturePhotoOutput. The API Changes indicates no changes for the AVFoundation Framework from Xcode 9 Beta 6 to Xcode 9 GM, but it seems to have a changed.


Can anybody else confirm the problem?


Regards,

Andreas

Answered by Media Engineer in 259270022

Our apologies. For apps using Swift 3.2 or Swift 4.0, several AVFoundation capture APIs (public extensions on external protocol) were inadvertently marked private in Xcode 9.


The following AVFoundation API are temporarily unavailable:

* `AVCaptureDevice.Format.supportedColorSpaces`

* `AVCaptureDevice.supportedFlashModes`

* `AVCapturePhotoOutput.availablePhotoPixelFormatTypes`

* `AVCapturePhotoOutput.availableRawPhotoPixelFormatTypes`

* `AVCapturePhotoSettings.availablePreviewPhotoPixelFormatTypes`


As a workaround you can use the SwiftPrivate versions of these API by prepending each API with double underscore (`__`). For example, change `AVCaptureDevice.Format.supportedColorSpaces` to `AVCaptureDevice.Format.__supportedColorSpaces`.

We have the same problem. It seems like `supportedFlashModes` is removed from `AVCapturePhotoOutput` documentation as well.


I think this is just a bug with the GM and will be fixed in the final release. For the time being the workaround is to use the undocumented `__supportedFlashModes` instead.

Thank goodness I found this. `__supportedFlashModes` works, but… uurgh!

Accepted Answer

Our apologies. For apps using Swift 3.2 or Swift 4.0, several AVFoundation capture APIs (public extensions on external protocol) were inadvertently marked private in Xcode 9.


The following AVFoundation API are temporarily unavailable:

* `AVCaptureDevice.Format.supportedColorSpaces`

* `AVCaptureDevice.supportedFlashModes`

* `AVCapturePhotoOutput.availablePhotoPixelFormatTypes`

* `AVCapturePhotoOutput.availableRawPhotoPixelFormatTypes`

* `AVCapturePhotoSettings.availablePreviewPhotoPixelFormatTypes`


As a workaround you can use the SwiftPrivate versions of these API by prepending each API with double underscore (`__`). For example, change `AVCaptureDevice.Format.supportedColorSpaces` to `AVCaptureDevice.Format.__supportedColorSpaces`.

Are we allowed to submit a build using these private APIs without rejection in the meantime?

We will be allowed to submit to the store using as is?

This issue is still in the Xcode 9 released today (public version)

I can confirm that use of these __*** versions of the APIs is legitimate and is not considered SPI use.

Nothing specific about this thread, I am just curious what does SPI stand for?

Likely "System Private Interface"

Looks like the same bug is introduced again in Xcode 12 beta 6.
Wow. yeah I am in agreement with jh_tds, this has reappeared in XC 12 beta6.
The issue still persists in Xcode 12 GM. This is such an unfortunate. 😞
This problem persists in Xcode GM 12A7208 and 12A7209.
Still persists in Xcode 12.2 beta (12B5018i)

FB8540095
There is a regression of this bug, it's reproducible in Xcode 12.0 (12A7209), but only when targeting the simulator. It works fine for a real device.

Here's an example workaround that I'm using in Swift 5.3:
Code Block swift
#if targetEnvironment(simulator)
let pixelFormat = photoSettings.__availablePreviewPhotoPixelFormatTypes.first!
#else
let pixelFormat = photoSettings.availablePreviewPhotoPixelFormatTypes.first!
#endif
// make use of `pixelFormat`


Undefined symbols for supportedFlashModes in AVCapturePhotoOutput
 
 
Q