I have a macOS app which uses AVFoundation that was building fine with XCode 12 Beta 2. In Beta 3, I get:
I didn't see anything about this in the known issues of Beta 3. Does anyone have any thoughts on what's going on?
Code Block Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.0.sdk/usr/lib/swift/AVFoundation.swiftmodule/x86_64-apple-macos.swiftinterface:72:11: 'AVAudioSession' is unavailable in macOS /AVFoundation.AVAudioSession:2:12: 'AVAudioSession' has been explicitly marked unavailable here
Code Block Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.0.sdk/usr/lib/swift/AVFoundation.swiftmodule/x86_64-apple-macos.swiftinterface:129:11: 'AVAudioSession' is unavailable in macOS /AVFoundation.AVAudioSession:2:12: 'AVAudioSession' has been explicitly marked unavailable here
Code Block Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.0.sdk/usr/lib/swift/AVFoundation.swiftmodule/x86_64-apple-macos.swiftinterface:1:1: Failed to build module 'AVFoundation' from its module interface; the compiler that produced it, 'Apple Swift version 5.3 (swiftlang-1200.2.22.2 clang-1200.0.25.1)', may have used features that aren't supported by this compiler, 'Apple Swift version 5.3 (swiftlang-1200.0.22.4 clang-1200.0.25.1)'
I didn't see anything about this in the known issues of Beta 3. Does anyone have any thoughts on what's going on?
I hit the same error and out of curiosity I created a new empty project, and discovered that it failed to build as soon as I added "import AVFoundation" to any source file... so it looks like a bug in the macOS SDK.
I looked at the .swiftinterface file for AVFoundation (for my build platform it was 'AVFoundation.swiftmodule/x86_64-apple-macos.swiftinterface') and the problem seems to be that 'extension AVAudioSession.Location' is not explicitly marked as unavailable on macOS. Because it's an extension to AVAudioSession and AVAudioSession is marked as unavailable it won't compile.
So I added '@available(OSX, unavailable)' in two different places where the extension to AVAudioSession is defined. So where it looked like this:
I changed it to this:
That got everything compiling and working again.
I looked at the .swiftinterface file for AVFoundation (for my build platform it was 'AVFoundation.swiftmodule/x86_64-apple-macos.swiftinterface') and the problem seems to be that 'extension AVAudioSession.Location' is not explicitly marked as unavailable on macOS. Because it's an extension to AVAudioSession and AVAudioSession is marked as unavailable it won't compile.
So I added '@available(OSX, unavailable)' in two different places where the extension to AVAudioSession is defined. So where it looked like this:
Code Block language @available(iOS 7.0, watchOS 2.0, tvOS 9.0, *) extension AVAudioSession.Location {
I changed it to this:
Code Block language @available(OSX, unavailable) @available(iOS 7.0, watchOS 2.0, tvOS 9.0, *) extension AVAudioSession.Location {
That got everything compiling and working again.