Cannot preview in this file, failed to launch

I am not able to use SwiftUI Preview Here is the report I get while trying to see the issue:

== DATE:

    Thursday, 26 December 2024 at 8:17:41 AM Eastern European Standard Time
    
    2024-12-26T06:17:41Z



== PREVIEW UPDATE ERROR:

    FailedToLaunchAppError: Failed to launch com.organization.testProject
    
    ==================================
    
    |  [Remote] JITError
    |  
    |  ==================================
    |  
    |  |  [Remote] CouldNotLoadInputObjectFile: Could not load object file during preview: /Users/wael/Library/Developer/Xcode/DerivedData/testProject-aqtqxxekqatxonfbjzyqrtixfviz/Build/Intermediates.noindex/testProject.build/Debug-iphonesimulator/testProject.build/Objects-normal/arm64/ContentView.o
    |  |  
    |  |  path: /Users/wael/Library/Developer/Xcode/DerivedData/testProject-aqtqxxekqatxonfbjzyqrtixfviz/Build/Intermediates.noindex/testProject.build/Debug-iphonesimulator/testProject.build/Objects-normal/arm64/ContentView.o
    |  |  
    |  |  ==================================
    |  |  
    |  |  |  [Remote] XOJITError
    |  |  |  
    |  |  |  XOJITError: '/Users/wael/Library/Developer/Xcode/DerivedData/testProject-aqtqxxekqatxonfbjzyqrtixfviz/Build/Intermediates.noindex/testProject.build/Debug-iphonesimulator/testProject.build/Objects-normal/arm64/ContentView.o': No such file or directory



== PREVIEW UPDATE ERROR:

    FailedToLaunchAppError: Failed to launch com.organization.testProject
    
    ==================================
    
    |  [Remote] JITError
    |  
    |  ==================================
    |  
    |  |  [Remote] CouldNotLoadInputObjectFile: Could not load object file during preview: /Users/wael/Library/Developer/Xcode/DerivedData/testProject-aqtqxxekqatxonfbjzyqrtixfviz/Build/Intermediates.noindex/testProject.build/Debug-iphonesimulator/testProject.build/Objects-normal/arm64/ContentView.o
    |  |  
    |  |  path: /Users/wael/Library/Developer/Xcode/DerivedData/testProject-aqtqxxekqatxonfbjzyqrtixfviz/Build/Intermediates.noindex/testProject.build/Debug-iphonesimulator/testProject.build/Objects-normal/arm64/ContentView.o
    |  |  
    |  |  ==================================
    |  |  
    |  |  |  [Remote] XOJITError
    |  |  |  
    |  |  |  XOJITError: '/Users/wael/Library/Developer/Xcode/DerivedData/testProject-aqtqxxekqatxonfbjzyqrtixfviz/Build/Intermediates.noindex/testProject.build/Debug-iphonesimulator/testProject.build/Objects-normal/arm64/ContentView.o': No such file or directory



== VERSION INFO:

    Tools: 16C5032a
    OS:    24C101
    PID:   68592
    Model: MacBook Pro
    Arch:  arm64e



== ENVIRONMENT:

    openFiles = [
        /Users/Wael/Desktop/testProject/testProject/ContentView.swift
    ]
    wantsNewBuildSystem = true
    newBuildSystemAvailable = true
    activeScheme = testProject
    activeRunDestination = Wael’s iPhone variant iphoneos arm64
    workspaceArena = [x]
    buildArena = [x]
    buildableEntries = [
        testProject.app
    ]
    runMode = JIT Executor



== SELECTED RUN DESTINATION:

    iOS 18.2 | iphoneos | arm64 | iPhone 15 | no proxy



== EXECUTION MODE OVERRIDES:

    Workspace JIT mode user setting: true
    Falling back to Dynamic Replacement: false



== PACKAGE RESOLUTION ERRORS:

    



== REFERENCED SOURCE PACKAGES:

    



== JIT LINKAGE:

    Run Destination: 24E03AA4-D67B-4B1B-A41D-848D46470AFD-iphonesimulator18.2-arm64-iphonesimulator
    JIT Link Description {
        3:testProject.app
    }
    



== SESSION GROUP 8691:

    workspace identifier: WorkspaceIdentifier(identifier: 7CDE1D62-EA21-400D-B884-63FAFBBC1E9A)
    providers: [
        Preview Provider | Registry-ContentView.swift#1[preview] [Editor(7983)]
    ]
    translation units: [
        /Users/Wael/Desktop/testProject/testProject/ContentView.swift
    ]
    attributes: [
        Editor(7983):     []
    ]
    session: 8692
    request sessions: [
        Registry[Registry-ContentView.swift#1[preview] (line 22)]: not completed
    ]



== UPDATE SESSION 8692:

    Start Date: Thursday, 26 December 2024 at 8:03:57 AM Eastern European Standard Time
    Timing {
        Elapsed Time: 10.912503957748413s
        68ec4d8d3f7fb4c9,756885837.367845,10.912503957748413s,,PreviewUpdateSession,id:8692
        ce2653a1068f2d54,756885837.413808,0.0005509853363037109s,,MakeBuildGraph,
        f9c95905699b9f16,756885837.416575,0.005656003952026367s,,AllBuiltTargetDescriptions,
        afb79b6af2b41fa2,756885837.416658,0.005461931228637695s,,IDEBuiltTargetDescriptionRequest,
        5476e56aa0f0ee3b,756885837.426578,0.34538090229034424s,,AgentLaunch,
    }
    Preview Preflight {
        UpdaterStore {
            updaterLimit: single
            expectedAbandonedIdentifiers: [8695, 8683, 8037, 7960]
        }
        Simulator {
            platform: iphonesimulator
            device: A4F87D0C-671C-4B28-8464-BF309FEC56AA iPhone 16 Pro
            buildNumber: 22C150
            runtimePath: /Library/Developer/CoreSimulator/Volumes/iOS_22C150/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 18.2.simruntime
        }
        host bundle: 
        com.organization.testProject {
            url: file:///Users/wael/Library/Developer/Xcode/DerivedData/testProject-aqtqxxekqatxonfbjzyqrtixfviz/Build/Products/Debug-iphonesimulator/testProject.app
            version: 8675
            signingInformation: 
            Code Signing {
                identifier: com.organization.testProject
                hasGetTaskAllow: false
                isSandboxed: false
            }
            attributes: [
                LaunchConfigArgumentsPreviewAttributesKey: [],
                AppExtensionIdentifierPreviewAttributeKey: nil,
                AgentCompanionAppBundleIdentifierKey: nil,
                AgentRunModeKey: JIT Executor,
                LaunchConfigEnvironmentVariablesPreviewAttributesKey: ["OS_LOG_TRANSLATE_PRINT_MODE": "0x80", "__XPC_DYLD_LIBRARY_PATH": "/Users/wael/Library/Developer/Xcode/DerivedData/testProject-aqtqxxekqatxonfbjzyqrtixfviz/Build/Products/Debug-iphonesimulator", "DYLD_FRAMEWORK_PATH": "/Users/wael/Library/Developer/Xcode/DerivedData/testProject-aqtqxxekqatxonfbjzyqrtixfviz/Build/Products/Debug-iphonesimulator", "OS_LOG_DT_HOOK_PREFIX": "OSLOG-2495ADD1-886F-45A1-902B-62D240E9730F", "DYLD_INSERT_LIBRARIES": "/Library/Developer/CoreSimulator/Volumes/iOS_22C150/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 18.2.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libLogRedirect.dylib", "PACKAGE_RESOURCE_BUNDLE_PATH": "/Users/wael/Library/Developer/Xcode/DerivedData/testProject-aqtqxxekqatxonfbjzyqrtixfviz/Build/Products/Debug-iphonesimulator", "OS_ACTIVITY_TOOLS_PRIVACY": "YES", "OS_ACTIVITY_TOOLS_OVERSIZE": "YES", "IDE_DISABLED_OS_ACTIVITY_DT_MODE": "1", "__XPC_DYLD_FRAMEWORK_PATH": "/Users/wael/Library/Developer/Xcode/DerivedData/testProject-aqtqxxekqatxonfbjzyqrtixfviz/Build/Products/Debug-iphonesimulator", "__XCODE_BUILT_PRODUCTS_DIR_PATHS": "/Users/wael/Library/Developer/Xcode/DerivedData/testProject-aqtqxxekqatxonfbjzyqrtixfviz/Build/Products/Debug-iphonesimulator", "TERM": "dumb", "SQLITE_ENABLE_THREAD_ASSERTIONS": "1", "OS_LOG_DT_HOOK_MODE": "0x07", "DYLD_LIBRARY_PATH": "/Users/wael/Library/Developer/Xcode/DerivedData/testProject-aqtqxxekqatxonfbjzyqrtixfviz/Build/Products/Debug-iphonesimulator", "CFLOG_FORCE_DISABLE_STDERR": "1"],
                AgentRoleKey: Previews,
            ]
        }
        builtTargetDescriptions: Build Logs/ResolvedBuiltTargetDescriptions-request-1-com.organization.testProject.txt
    }
    Preview Provider {
        UpdaterStore {
            updaterLimit: single
            expectedAbandonedIdentifiers: [8695, 8683, 8037, 7960]
        }
        Simulator {
            platform: iphonesimulator
            device: A4F87D0C-671C-4B28-8464-BF309FEC56AA iPhone 16 Pro
            buildNumber: 22C150
            runtimePath: /Library/Developer/CoreSimulator/Volumes/iOS_22C150/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 18.2.simruntime
        }
        host bundle: 
        com.organization.testProject {
            url: file:///Users/wael/Library/Developer/Xcode/DerivedData/testProject-aqtqxxekqatxonfbjzyqrtixfviz/Build/Products/Debug-iphonesimulator/testProject.app
            version: 8675
            signingInformation: 
            Code Signing {
                identifier: com.organization.testProject
                hasGetTaskAllow: false
                isSandboxed: false
            }
            attributes: [
                LaunchConfigArgumentsPreviewAttributesKey: [],
                AppExtensionIdentifierPreviewAttributeKey: nil,
                AgentCompanionAppBundleIdentifierKey: nil,
                AgentRunModeKey: JIT Executor,
                LaunchConfigEnvironmentVariablesPreviewAttributesKey: ["OS_LOG_TRANSLATE_PRINT_MODE": "0x80", "__XPC_DYLD_LIBRARY_PATH": "/Users/wael/Library/Developer/Xcode/DerivedData/testProject-aqtqxxekqatxonfbjzyqrtixfviz/Build/Products/Debug-iphonesimulator", "DYLD_FRAMEWORK_PATH": "/Users/wael/Library/Developer/Xcode/DerivedData/testProject-aqtqxxekqatxonfbjzyqrtixfviz/Build/Products/Debug-iphonesimulator", "OS_LOG_DT_HOOK_PREFIX": "OSLOG-2495ADD1-886F-45A1-902B-62D240E9730F", "DYLD_INSERT_LIBRARIES": "/Library/Developer/CoreSimulator/Volumes/iOS_22C150/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 18.2.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libLogRedirect.dylib", "PACKAGE_RESOURCE_BUNDLE_PATH": "/Users/wael/Library/Developer/Xcode/DerivedData/testProject-aqtqxxekqatxonfbjzyqrtixfviz/Build/Products/Debug-iphonesimulator", "OS_ACTIVITY_TOOLS_PRIVACY": "YES", "OS_ACTIVITY_TOOLS_OVERSIZE": "YES", "IDE_DISABLED_OS_ACTIVITY_DT_MODE": "1", "__XPC_DYLD_FRAMEWORK_PATH": "/Users/wael/Library/Developer/Xcode/DerivedData/testProject-aqtqxxekqatxonfbjzyqrtixfviz/Build/Products/Debug-iphonesimulator", "__XCODE_BUILT_PRODUCTS_DIR_PATHS": "/Users/wael/Library/Developer/Xcode/DerivedData/testProject-aqtqxxekqatxonfbjzyqrtixfviz/Build/Products/Debug-iphonesimulator", "TERM": "dumb", "SQLITE_ENABLE_THREAD_ASSERTIONS": "1", "OS_LOG_DT_HOOK_MODE": "0x07", "DYLD_LIBRARY_PATH": "/Users/wael/Library/Developer/Xcode/DerivedData/testProject-aqtqxxekqatxonfbjzyqrtixfviz/Build/Products/Debug-iphonesimulator", "CFLOG_FORCE_DISABLE_STDERR": "1"],
                AgentRoleKey: Previews,
            ]
        }
        builtTargetDescriptions: Build Logs/ResolvedBuiltTargetDescriptions-request-2-com.organization.testProject.txt
    }
    Build Graph {
        testProject.app (#3)
           sourceFile(file:///Users/Wael/Desktop/testProject/testProject/ContentView.swift -> ContentView.swift) (#1)
           ContentView.swift (#2)
    }
    Update Plan {
        iOS [arm64 iphonesimulator18.2 iphonesimulator] (iPhone 16 Pro, 24E03AA4-D67B-4B1B-A41D-848D46470AFD-iphonesimulator18.2-arm64-iphonesimulator), [], thinning disabled, thunking enabled) {
            Destination: iPhone 16 Pro 24E03AA4-D67B-4B1B-A41D-848D46470AFD | default device for iphonesimulator [
                testProject app - Previews {
                    execution point packs [
                        [source: ContentView.swift, role: Previews] (in testProject)
                    ]
                    translation units [
                        ContentView.swift (in testProject.app)
                    ]
                    modules [
                        testProject.app
                    ]
                    jit link description [
                        testProject.app
                    ]
                }
            ]
        }
    }



== POWER STATE LOGS:

    26/12/2024, 7:47 AM Received power source state: Battery Powered (lowPowerMode: true, status: unplugged, level: 51%)
    26/12/2024, 7:47 AM Broadcasting device power state: Low Power
    26/12/2024, 7:47 AM No device power state user override user default value.
    26/12/2024, 7:48 AM Received power source state: Battery Powered (lowPowerMode: true, status: unplugged, level: 50%)
    26/12/2024, 7:54 AM Received power source state: Battery Powered (lowPowerMode: true, status: unplugged, level: 49%)
    26/12/2024, 7:59 AM Received power source state: Battery Powered (lowPowerMode: true, status: unplugged, level: 48%)
    26/12/2024, 8:03 AM Received power source state: Battery Powered (lowPowerMode: true, status: unplugged, level: 47%)
    26/12/2024, 8:11 AM Received power source state: Battery Powered (lowPowerMode: true, status: unplugged, level: 46%)
    26/12/2024, 8:14 AM Received power source state: Battery Powered (lowPowerMode: true, status: unplugged, level: 45%)Current power state: Low Power


And here is the call and code preview:

import SwiftUI

struct ContentView: View {
    var body: some View {
        VStack {
            Image(systemName: "globe")
                .imageScale(.large)
                .foregroundStyle(.tint)
            Text("Hello, world!")
        }
        .padding()
    }
}

#Preview {
    ContentView()
}

Please update.

Same happened to me.

https://forums.developer.apple.com/forums/thread/771428

Let's boost so Apple will fix this.

Thanks for reporting this and for sharing the diagnostics! We're digging in to see how this is happening. If you have a moment, can you reproduce and when you see the diagnostic sheet that shows this text error, click the button at the bottom to file a feedback with the full diagnostics. This will help us track it.

Cannot preview in this file, failed to launch
 
 
Q