When I try to delete an iPhone 16 Pro iOS 18.1 Simulator in XCode 16.1, I get an error message "“data” couldn’t be moved because you don’t have permission to access “Deleting-8366D3CC-37EC-49C0-8674-0599BCE1DA12”.". I had that same issue with iOS 18.0 Simulator but never with previous versions (17.5).
Note that I'm stuck using the iOS 18.1 Simulator because iCloud synchronization is paused (potentially due to low data mode).
And I cannot use iOS 18.0 Simulator as well because unit tests run hangs for some other mysterious reason.
The fallback to iOS 17.5 Simulator is not satisfactory.
Xcode
RSS for tagBuild, test, and submit your app using Xcode, Apple's integrated development environment.
Post
Replies
Boosts
Views
Activity
Hi there,
when I run any app on the Xcode 16/16.1 with iOS/tvOS 18/18.1,
it generates a crash on the AccessibilityControlsExtension process.
0x1048b8000 - 0x10493bfff dyld (*) <6beafde4-b011-3e47-8aae-4d7b6e4bb7e8> /usr/lib/dyld
0x1047fc000 - 0x104803fff com.apple.AccessibilityUIServer.AccessibilityControlsExtension (1.0) <a67e159b-253d-306c-b6fb-dd3fec38bd0f> /Volumes/VOLUME/*/AccessibilityUIServer.app/PlugIns/AccessibilityControlsExtension.appex/AccessibilityControlsExtension
If run in Catalist mode - there are no crash reports.
I also made a clean install of macOS 15.1 + Xcode and received that error again.
Device: Mac15,13
Any suggestions on how to fix it?
Full crash log in attach.
AccessibilityControlsExtension-crash.log
When running a simple C++ OpenGL project in Xcode, multiple instances of the program are created and launched by Xcode when I build and run...I am not sure why it happens, does anyone know how can I stop this?
My macos update automatically and the new macos SDK are not fit for my program, so how to use a lower version macos SDK?
And I have another problem, once I installed Xcode, the SDK will be set path to Xcode path, also I have a command line path which is /Library/Developer/CommandlineTools. In this path, there is also a SDKs directory which contains some different versions of macos SDK? How to set a default SDK path?
Hello,
I'm unable to run any test cases in Xcode 16 with the iOS 18 simulator.
Steps to Reproduce:
Create a new iOS project in Xcode 16 using the default iOS app template with the testing option checked.
Run any test or UI test case by clicking the "Play" icon in the Test navigator.
Xcode gets stuck at the "Testing" state indefinitely.
Environment:
macOS 15 beta 8
Xcode 16 beta 6
iOS 18 beta 7 simulator
Capturing a Metal workload in Xcode, exporting a .gputrace file, is there a way to export the data using the command line, just like .memgraph can use malloc_history --quiet to export the data as text
Hello! 👋
We are seeing a bug on macOS Sequoia related to the test running.
When attempting to run tests, the iOS simulator becomes stuck indefinitely. This can occur whether we run tests for a specific module, all unit tests, or even a single test.
We narrowed down the issue and is due to the OS failing to copy some named pipes (FIFO). For example:
db.realm.note
db.realm.management/access_control.new_commit.cv
db.realm.management/access_control.pick_writer.cv
We saw in the CoreSimulator log file the following error:
NSCocoaErrorDomain Code=512 ""access_control.new_commit.cv" couldn't be copied
The copy fails and then a new clone of the simulator is created retrying the process. And this goes on and on.
What is happening?
When running the tests for the iOS app on the simulator, under the hood, the OS tries to clone the simulator device.
A list of folders is created, including one Shared/AppGroup. Under the AppGroup folder, the list of multiple UDIDs corresponds to the specific App Group containers created for individual app targets or extensions that are sharing data within that App Group.
One of these folders contains the Realm DB files. There are a few files called named pipes which are invisible in Finder (even if you have hidden files to true). You need to list them with ls -l.
So, when we select the test target and run the tests, the OS clones the permanent simulator and copies all files from its folders. All files are being copied except those pipes.
When the OS attempts to copy the pipes, the operation fails with the error Code=512.
Reproduction Steps
Run the iOS app on a simulator (e.g. iPhone SE 3rd gen. with iOS 18.1).
Quit Xcode and the iOS simulator.
Reopen Xcode.
Select a test target to run.
Select the same simulator you previously ran the iOS app.
Run the tests (CMD + U).
The simulator is now stuck.
Are there any workarounds available?
Yes. We found that running the tests works if we first “Erase All Content and Settings” from the simulator.
Another workaround is to remove all simulators and reinstall the iOS runtimes. This prevents the issue for a longer period (almost a full day), but eventually, the problem reoccurs.
Alternatively, we can delete the named pipes from the App Groups directory before running the tests.
Have we tried to give full disk permissions?
Yes, we tried to give full disk permissions to a lot of things (Xcode, simulator, file paths, directories, etc.) but with no luck. We still get the same error.
Is the issue happening on a specific version of Xcode?
No, it happens for multiple Xcode versions:
Xcode 15.4
Xcode 16.0
Xcode 16.1
Is the issue happening on a specific macOS Sequoia version?
No, it happens on multiple macOS Sequoia versions:
15.0 Beta 8
15.0 RC
15.0
15.1
Stacktrace
Oct 29 17:41:18 CoreSimulatorService[14079] <Error>: New device is stuck in creation state, deleting: Clone 712 of iPhone SE (3rd generation) (58D6DED6-2C55-4E7C-BBB4-E0D661DC41A1, iOS 18.1, Creating)
Oct 29 17:41:20 CoreSimulatorService[14079] <Error>: Error Domain=NSPOSIXErrorDomain Code=22 "Invalid argument" UserInfo={NSLocalizedFailureReason=Device was allocated but was stuck in creation state. Check CoreSimulator.log for more information.}
Oct 29 17:41:20 com.apple.dt.Xcode[90147] <Error>: Error Domain=NSPOSIXErrorDomain Code=22 "Invalid argument" UserInfo={NSLocalizedFailureReason=Device was allocated but was stuck in creation state. Check CoreSimulator.log for more information.}
Oct 29 17:41:30 CoreSimulatorService[14079] <Warning>: Device 6C270BDB-2945-42B5-A985-884F93BFD3E1 encountered in creation state at launch. The device will be re-created.
Oct 29 17:41:38 CoreSimulatorService[14079] <Error>: Failed to clone the device data path, error = Error Domain=NSCocoaErrorDomain Code=512 "“access_control.new_commit.cv” couldn’t be copied to “db.realm.management”." UserInfo={NSSourceFilePathErrorKey=[...]/db.realm.management/access_control.new_commit.cv, NSUserStringVariant=(
Copy
), NSDestinationFilePath=[...]/db.realm.management/access_control.new_commit.cv, NSUnderlyingError=0x600000ffa490 {Error Domain=NSPOSIXErrorDomain Code=45 "Operation not supported"}}
Oct 29 17:41:38 CoreSimulatorService[14079] <Error>: Failed to re-create device that was encountered in the creation state (Clone 713 of iPhone SE (3rd generation) (6C270BDB-2945-42B5-A985-884F93BFD3E1, iOS 18.1, Creating)): Error Domain=NSCocoaErrorDomain Code=512 "“access_control.new_commit.cv” couldn’t be copied to “db.realm.management”." UserInfo={NSSourceFilePathErrorKey=[...]/db.realm.management/access_control.new_commit.cv, NSUserStringVariant=(
Copy
), NSDestinationFilePath=[...]/db.realm.management/access_control.new_commit.cv, NSUnderlyingError=0x600000ffa490 {Error Domain=NSPOSIXErrorDomain Code=45 "Operation not supported"}}
Oct 29 17:41:40 CoreSimulatorService[14079] <Error>: Error Domain=NSPOSIXErrorDomain Code=22 "Invalid argument" UserInfo={NSLocalizedFailureReason=Device was allocated but was stuck in creation state. Check CoreSimulator.log for more information.}
Oct 29 17:41:50 CoreSimulatorService[14079] <Warning>: Device C6DEBFBB-6EFA-4E4C-B51B-9DDA08AF9BDB encountered in creation state at launch. The device will be re-created.
Oct 29 17:41:55 CoreSimulatorService[14079] <Error>: Failed to clone the device data path, error = Error Domain=NSCocoaErrorDomain Code=512 "“access_control.new_commit.cv” couldn’t be copied to “db.realm.management”." UserInfo={NSSourceFilePathErrorKey=[...]/db.realm.management/access_control.new_commit.cv, NSUserStringVariant=(
Copy
), NSDestinationFilePath=[...]/db.realm.management/access_control.new_commit.cv, NSUnderlyingError=0x600000ffb000 {Error Domain=NSPOSIXErrorDomain Code=45 "Operation not supported"}}
Oct 29 17:42:06 CoreSimulatorService[14079] <Warning>: Device 032BAE7E-E345-48F2-86EB-4DF1AD4D5291 encountered in creation state at launch. The device will be re-created.
Hi there.
We are trying to implement SensorKit into our App to explore the data quality of accelerometer data recorded even when the App is terminated. So far we managed everything to work, even the fetch, except the SRSensorReaderDelegate never seems to reach
func sensorReader(_ reader: SRSensorReader, fetching fetchRequest: SRFetchRequest, didFetchResult result: SRFetchResult) -> Bool { ... }
Any clue as to what we need to adjust in our code to get the FetchResult?
import Foundation
import SensorKit
import CoreMotion
import os.log
class SensorKitDataManager: NSObject, SRSensorReaderDelegate {
static let shared = SensorKitDataManager()
// Sensor Readers
let accelerometerReader = SRSensorReader(sensor: .accelerometer)
let rotationRateReader = SRSensorReader(sensor: .rotationRate)
let deviceUsageReader = SRSensorReader(sensor: .deviceUsageReport)
let phoneUsageReader = SRSensorReader(sensor: .phoneUsageReport)
let wristUsageReader = SRSensorReader(sensor: .onWristState)
var startTime: CFTimeInterval = CFTimeInterval(Date().timeIntervalSince1970)
var endTime: CFTimeInterval = CFTimeInterval(Date().timeIntervalSince1970)
override init() {
super.init()
configureSensorReaders()
}
// Configure sensor readers and set delegate
private func configureSensorReaders() {
if SRSensorReader(sensor: .accelerometer).authorizationStatus == .authorized {
accelerometerReader.delegate = self
}
...
}
func sensorReaderWillStartRecording(_ reader: SRSensorReader) {
print("\(reader.description) Delegate starts recording")
}
func sensorReader(_ reader: SRSensorReader, startRecordingFailedWithError error: Error)
{
print("\(reader.description) Delegate failed recording")
}
func sensorReader(_ reader: SRSensorReader, didChange authorizationStatus: SRAuthorizationStatus) {
if reader.sensor == .accelerometer {
if authorizationStatus == SRAuthorizationStatus.authorized {
accelerometerReader.startRecording()
}
else if authorizationStatus == SRAuthorizationStatus.denied {
accelerometerReader.stopRecording()
}
}
...
}
// Request SensorKit Authorization
func requestAuthorization() {
}
if UserDefaults.standard.bool(forKey: "JTrack_accelerometerEnabled") && accelerometerReader.authorizationStatus == .notDetermined {
SRSensorReader.requestAuthorization(sensors: [.accelerometer]) { error in
if let error = error {
os_log("Authorization denied: %@", log: OSLog.default, type: .error, error.localizedDescription)
} else {
os_log("Authorization granted for accelerometer sensor", log: OSLog.default, type: .info)
}
}
}
...
self.startRecordingIfAuthorized()
}
// Start recording for each authorized sensor
private func startRecordingIfAuthorized() {
if accelerometerReader.authorizationStatus == .authorized {
accelerometerReader.startRecording()
}
...
}
func fetchAllDataSinceJoined(from startTime: CFTimeInterval, to endTime: CFTimeInterval) {
self.startTime = startTime
self.endTime = endTime
if accelerometerReader.authorizationStatus == .authorized {
accelerometerReader.fetchDevices()
}
....
}
func stopAllRecordings() {
if accelerometerReader.authorizationStatus == .authorized {
accelerometerReader.stopRecording()
}
...
}
func sensorReader(_ reader: SRSensorReader, didFetch devices: [SRDevice]) {
let now = CFTimeInterval(Date().timeIntervalSince1970)
// Ensure the data is at least 24 hours old
let holdingPeriod: CFTimeInterval = 24 * 60 * 60 // 24 hours in seconds
let earliestFetchTime = now - holdingPeriod
// Adjust the start time if it's within the holding period
let adjustedStartTime = min(startTime, earliestFetchTime)
// If adjustedStartTime is after endTime, no data is available for fetching
guard adjustedStartTime < endTime else {
print("No data available to fetch as it falls within the 24-hour holding period.")
return
}
let fetchRequest = SRFetchRequest()
fetchRequest.from = SRAbsoluteTime(adjustedStartTime)
fetchRequest.to = SRAbsoluteTime(endTime)
// Log information about the devices that contributed data
for device in devices {
print("Device model: \(device.model), OS version: \(device.systemVersion), Identifier: \(device.description)")
if device.model == "iPhone" {
fetchRequest.device = device
}
}
if accelerometerReader.authorizationStatus == .authorized {
accelerometerReader.fetch(fetchRequest)
}
...
}
// SensorKit Delegate Methods
func sensorReader(_ reader: SRSensorReader, didCompleteFetch fetchRequest: SRFetchRequest) {
os_log("Fetch completed for sensor: %@", log: OSLog.default, type: .info, reader.sensor.rawValue)
}
func sensorReader(_ reader: SRSensorReader, fetching fetchRequest: SRFetchRequest, didFetchResult result: SRFetchResult<AnyObject>) -> Bool {
if reader.sensor == .accelerometer {
....
}
....
}
func sensorReaderDidStopRecording(_ reader: SRSensorReader) {
print("\(reader.description) Delegate stops recording")
}
func sensorReader(_ reader: SRSensorReader, stopRecordingFailedWithError error: Error) {
print("\(reader.description) Delegate failed stopping")
}
After upgrading to mac os 15.1 my Xcode has been complaining about iOS 18.1 that is missing. No matter what I do I cannot get it installed, I ended up clearing all caches, re-installing Xcode but that also failed. Downgrading to 16.0 or upgrading to 16.2 beta has the same issue.
Currently I cannot create any simulator or install any version of the iOS platform. Xcode would say it's installing but the runtime would not show up in the list. I have tried adding runtimes using xcrun simctl and also other methods indicated here.
Another colleague of mine that updated to OSX 15.1 also has the same issue so this doesn't seem like a isolated problem.
In the screenshots below you'll see 18.1 is installed but does not show up as an installed runtime.
Hi!
I am trying to test an app developed in Xcode 16.1 on an iPhone 7 running iOS 15.8.3. My MacOS is 15.0.1 (Sequoia). But I am getting "iPhone is busy" no matter what I do. And yes - Finder can see the iPhone 7 and show information about it.
I have followed a lot of advice that is supposed to solve this, for instance here: https://forums.developer.apple.com/forums/thread/692230
And here:
https://stackoverflow.com/questions/46316373/fixing-xcode-9-issue-iphone-is-busy-preparing-debugger-support-for-iphone/48238062
But nothing works. Actually it's getting worse...
At one point it said "100% complete", although it was still "busy". But now I don't even get to the "100% complete" message... (After 30 minutes.)
So my conclusion is that it's impossible to use an iPhone 7 running iOS 15.8.3 to test an app developed in Xcode 16.1 on MacOS 15.0.1.
Am I right? In that case: Which iPhone models and iOS versions can be used instead?
I'm trying to create the app icon for my visionOS app. The Assets catalog already contains AppIcon for iOS and I've added another AppIcon for visionOS.
If I only add the Back layer of the visionOS icon, compiling succeeds despite there being an error
The visionOS App Icon "AppIcon" must have at least 2 layers with applicable content. Although it has 3 layers, only 1 has applicable content.
As soon as I add one of the other two layers, say the Front layer, compiling fails, but this time Xcode only shows a generic compiler error
Command CompileAssetCatalogVariant emitted errors but did not return a nonzero exit code to indicate failure
If I click that message, a long build log opens containing among other things:
2024-10-31 11:28:15.258 AssetCatalogSimulatorAgent[66919:1456355] -[TDTextureRawRenditionSpec _createImageRefWithURL:andDocument:format:] Texture image asset file:///~/Documents/apps/myApp/xcode/iOS/Assets.xcassets/AppIcon.solidimagestack/Back.solidimagestacklayer/Content.imageset/icon_layer3.heic not in one of supported formats
...
libc++abi: terminating due to uncaught exception of type NSException
Command CompileAssetCatalogVariant failed with a nonzero exit code
What is the problem?
I filed FB15642844.
Hello,
i know this topic is here since ever, also in other forums, however this topic i face for a month and cant get pass it, I tried all other suggestions which didnt bring me anywhere.
so, project using cmake in order for Qt creator (so c++ base project with enabled swift), however once i run a cmake which generates *.xcodeproj for Xcode, i open it via xcode and can properly build and deploy to device.
however when I try to archive and sent to Testflight/AppStore, I get:
ITMS-90426: Invalid Swift Support
and when I try to followup guides to create it manualy, copying libs from:
$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)
plese here note, that ALL guides indicate to use folder "swift", however there are no *.dylib files... they are only in "swift-5.0" folder
then I receive an error type:
ITMS-90429: Invalid Swift Support - The files libswiftMetal.dylib, libswiftHomeKit.dylib, libswiftsimd.dylib, libswiftCallKit.dylib, libswiftos.dylib, libswiftNetwork.dylib, libswiftMapKit.dylib, libswiftCoreLocation.dylib, libswiftAccelerate.dylib, libswiftCoreGraphics.dylib, libswiftSceneKit.dylib, libswiftCoreData.dylib, libswiftGameplayKit.dylib, libswiftUIKit.dylib, libswiftMetalKit.dylib, libswiftCore.dylib, libswiftFoundation.dylib, libswiftPhotos.dylib, libswiftModelIO.dylib, libswiftWatchKit.dylib, libswiftDarwin.dylib, libswiftARKit.dylib, libswiftAssetsLibrary.dylib, libswiftSpriteKit.dylib, libswiftNaturalLanguage.dylib, libswiftCoreAudio.dylib, libswiftIntents.dylib, libswiftQuartzCore.dylib, libswiftObjectiveC.dylib, libswiftDispatch.dylib, libswiftCoreFoundation.dylib, libswiftCoreMedia.dylib, libswiftVision.dylib, libswiftAVFoundation.dylib, libswiftContacts.dylib, libswiftGLKit.dylib, libswiftSwiftOnoneSupport.dylib, libswiftXCTest.dylib, libswiftMediaPlayer.dylib, libswiftCloudKit.dylib, libswiftCoreImage.dylib aren’t at the expected location /Payload/Filmtoro.app/Frameworks. Move the file to the expected location, rebuild your app using the current public (GM) version of Xcode, and resubmit it.
here please also note that actually *.xcarchive does not contain any "Payload" folder, the package contains only two folders "dSYMs" and "Production/Applications/myapp.app" (inside it I can find "Frameworks" folder...
this link was also very interested:
https://indiestack.com/2017/03/implicit-swift-dependencies/
tho id didnt help a bit :)
so what I would like to know, is what actually forces xcode to generate the SwiftSupport folder to the archive... the must be some direct setting inside *.xcodeproj/pbxproj which forces it... or dirrect setting in xcode/Build Settings which if not work I can submit an ticket to investigate.
I am sure after a month of trying everything, whatever tip you can point out I already tried, however Please lets try everything again to get bottom of this.
Many thanks for any tip
Without using XCode, the different XCode simulators keep showing up in Finder under locations. Is this normal behaviour? I'd rather not have this happen all the time..
(XROS is VisionOS...)
This is what the volume looks like...
Does anyone know where I can find an example of creating a NSView subclass with custom bindings. I need to be able to bind to the object in interface builder.
This is the only reference in Apple documents but as is often the case there appear to be no examples.
https://developer.apple.com/documentation/objectivec/nsobject/nskeyvaluebindingcreation
Process: Xcode [46981]
Path: /Applications/Xcode.app/Contents/MacOS/Xcode
Identifier: com.apple.dt.Xcode
Version: 16.1 (23503)
Build Info: IDEApplication-23503000000000000~2 (16B40)
App Item ID: 497799835
App External ID: 869932297
Code Type: ARM-64 (Native)
Parent Process: launchd [1]
User ID: 501
Date/Time: 2024-10-29 22:18:00.8018 -0400
OS Version: macOS 15.0.1 (24A348)
Report Version: 12
Anonymous UUID: F4176F67-35F3-B671-D872-71337475C3C0
Sleep/Wake UUID: 99252DE9-57D7-4F75-8279-42DA5C7689AD
Time Awake Since Boot: 170000 seconds
System Integrity Protection: enabled
Crashed Thread: 1
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Termination Reason: Namespace SIGNAL, Code 6 Abort trap: 6
Terminating Process: Xcode [46981]
Application Specific Information:
abort() called
To make UI testing easier and faster, I usually create URL bookmarks during normal app usage in the Simulator so that they can be instantly resolved on app launch during UI tests. For example, one of my apps allows browsing selected folders and stores bookmarks so they can be quickly opened again on following app launches, and instead of selecting the test folder each time at the beginning of the UI test, I select it once during normal app usage so that it's available immediately during the UI test.
This usually works fine, but every now and then the UI tests fail because the tested app isn't able to resolve the stored bookmark. I don't know why this happens, but usually opening and closing the app again in the Simulator and re-running the UI tests solves the issue.
The problem now is that I've just tried to setup some new UI tests for Apple Vision Pro Simulator and I'm never able to resolve bookmarks. So I created a sample project that reproduces the issue, and curiously enough the bookmarks don't even resolve when using an iPad Simulator (which usually works fine with my regular UI tests).
What am I doing wrong? This can be reproduced with a default iOS project, embedding the default storyboard view controller in a navigation view controller, and this code:
import UIKit
class ViewController: UIViewController, UIDocumentPickerDelegate {
override func viewDidLoad() {
navigationItem.rightBarButtonItem = UIBarButtonItem(systemItem: .add, primaryAction: UIAction(handler: { _ in
let picker = UIDocumentPickerViewController(forOpeningContentTypes: [.folder])
picker.delegate = self
self.present(picker, animated: true)
}))
if let bookmark = UserDefaults.standard.data(forKey: "bookmark") {
readBookmark(bookmark)
}
}
func readBookmark(_ bookmark: Data) {
do {
let label = UILabel(frame: CGRect(x: 100, y: 100, width: 600, height: 100))
label.numberOfLines = 0
var stale = false
let url = try URL(resolvingBookmarkData: bookmark, bookmarkDataIsStale: &stale)
if !url.startAccessingSecurityScopedResource() {
fatalError()
}
label.text = url.path
view.addSubview(label)
} catch {
fatalError(error.localizedDescription)
}
}
func documentPicker(_ controller: UIDocumentPickerViewController, didPickDocumentsAt urls: [URL]) {
do {
let url = urls[0]
if !url.startAccessingSecurityScopedResource() {
fatalError()
}
let bookmark = try url.bookmarkData()
UserDefaults.standard.set(bookmark, forKey: "bookmark")
readBookmark(bookmark)
} catch {
fatalError(error.localizedDescription)
}
}
}
And a default UI test, which always crashes because of the fatalError() in the catch clause of readBookmark(_:):
final class problemUITests: XCTestCase {
@MainActor
func testExample() throws {
let app = XCUIApplication()
app.launch()
}
}
This is really a disgusting function and I can't turn it off. Because the check box is grey, no way to turn it off. Even I connect my device via cables.
Debug becomes slow. Although I connect my device via cable.
And I'm developing a VPN application, it's rediculous that once I connect VPN from my device, Xcode will disconnect from my device.
I can't stand this function any m
ore. Does anyone know how to turn it off?
I've upgrade my macbook m3 pro to macOS 15, I have 2 iPhones (12 Pro and 16 Pro) - both on iOS 18 and have 3 versions of Xcode installed (15.4, 16.0, 16.1-2 beta)
For the past week I'm unable to develop on my physical device and checked all the threads in this forum for a workaround to disable the "Connect via Network".
If I'm not connected to VPN on any of my devices, I get the process attached via network after ~20 minutes, but if I try to do it while on VPN it takes forever (not even sure, can't spend 1 hour waiting to be attached or not)
What can I do to disable the "Connect via Network" and why is enabled by default and greyed out?
Hey Community,
i am not able to reinstall or remove the iOS 18.1 runtime. Instead it shows me a status unavailable. What can i do to reinstall or remove the runtime?
In the Xcode Settings it says status anavailable. Even if i deleted the runtime manually.
Up until now, it was possible to check in build scripts via the ENABLE_PREVIEWS environment variable whether a build for a SwiftUI preview is being executed.
In addition, it was also possible to conditionally compile code for SwiftUI or exclude it from compilation using this variable.
This no longer works with Xcode 16 and the new SwiftUI Preview compilation!
There is still the option to switch to the old system with the "Use Legacy Previews Execution" setting, but as stated in the release notes, this option will be removed at some point.
Which brings us back to the old problem of not being able to exclude build scripts from preview builds and not being able to prevent certain code from being compiled / add special code for SwiftUI previews.
This is a terrible situation, especially for more complex projects in which precisely the points mentioned are important for the build process.
I seriously hope Apple provides us with another environment variable for SwiftUI preview builds that we can use.