Xcode 14.3 deprecating QuartzCore APIs in a weird way
Asked Answered
M

2

6

Apple deprecated some of the APIs for macOS screen capturing starting from Xcode 14.3. For example: CGDisplayStream.showCursor is marked as deprecated in macOS 13.0-13.3:

enter image description here

However, when I check that in Xcode 14.3, I see that this property was introduced in macOS 13:

enter image description here How am I supposed to ubserstand this? It was not introduced in 13.0. I was using it since macOS 10. If you check the same property in Xcode 14.2:

enter image description here

Same applies to CGDisplayStream.init and others. Has anybody any ideas about this?

Marrakech answered 5/5, 2023 at 11:23 Comment(6)
It looks like a bug to me: CGDisplayStream... macOS 13.3 SDK ErrorStrander
most likely not a bug, Apple is forcing us to move to ScreenCaptureKitSputter
@trident the bug is CG_AVAILABLE_BUT_DEPRECATED(13.0, 14.0 instead of CG_AVAILABLE_BUT_DEPRECATED(10.8, 14.0. Why would CGDisplayStream be available in 13.0 but not in 12.0 anymore? To me it looks like a replace error.Strander
@Willeke, I am not sure either. but the change is consistent in both Xcode API description and documentation at developer.apple.com. I might not be a coincidence, but we will have to wait to find out the truth in coming macOS versions.Sputter
@Strander As I mentioned earlier, it is addressed in Xcode 15, as the issue is no longer seen with Xcode 15.0.1. All the APIs are enabled from 10.8 macOS onwards, but deprecated in 14.0, so it is still advised to move to the new ScreenCaptureKit API ASAP.Sputter
@Sputter The question is not about the deprecation in 14.0, it's about the introduction in 13.0 instead of 10.8. The bug is now fixed.Strander
M
3

That seems to be fixed in Xcode 15. Now the deprecation annotation contains correct macOS version.

Marrakech answered 2/8, 2023 at 8:40 Comment(0)
S
1

I also ran into this issue today after upgrading Xcode to 14.3, looks like Apple has found a new way to convey that these constants are going to be deprecated very soon and better to move to ScreenCaptureKit framework or find alternatives.

The only work around I found to this problem is to convert these Swift implementations to Objective C and compile the code using Xcode 14.3, or build the binaries with old Xcode 14.2. When you convert the implementations to Objective C and compile with Xcode 14.3 it would still give you warnings but the code works just fine.

Not sure you are going to like this approach but thought to share.

Sputter answered 9/5, 2023 at 21:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.