PC パソコン

How to Handle “XCPreviewAgent: EXC_BAD_ACCESS (SIGSEGV)” in Xcode 27 Previews

In Xcode 27, a SwiftUI preview can fail even though the project builds and the app runs normally. The preview-only XCPreviewAgent process terminates with EXC_BAD_ACCESS (SIGSEGV). Based on a September 2026 report on the Apple Developer Forums, this article explains how to distinguish an app crash from a preview-infrastructure crash, continue working with a temporary alternative, and collect the diagnostics Apple requested.

Representative crash logs

XCPreviewAgent
Exception: EXC_BAD_ACCESS (SIGSEGV)
Termination: Segmentation fault: 11

Crashing Thread:
libswiftCore.dylib
swift_conformsToProtocolMaybeInstantiateSuperclasses(...)
swift_conformsToProtocolWithExecutionContext
swift::_conformsToProtocol(...)
swift::_checkGenericRequirements(...)

The same report recorded a second signature after removing an unrelated dependency:

Exception: EXC_BAD_ACCESS (SIGSEGV)
KERN_INVALID_ADDRESS

Crashing Thread: com.apple.xojit_executor.wrapper_functions
libobjc.A.dylib readClass(objc_class*, bool, bool)
libobjc.A.dylib map_images_nolock
libobjc.A.dylib map_images
libobjc.A.dylib _objc_map_images

What causes the crash?

The submitted crash reports show either Swift protocol-conformance processing or the Objective-C runtime failing while loading an image used by the preview’s JIT execution path. The reporter reproduced the issue in a large app target with many Swift packages and frameworks. Standard preview execution crashed, while Legacy Preview Execution rendered the previews.

Important: Apple has not confirmed the root cause. Do not state that project size, JIT compilation, or a particular framework is definitively responsible. An Apple Developer Tools Engineer said that investigation would require a reproducible project or, at minimum, a preview diagnostics report submitted through Feedback Assistant.

Affected conditions and versions

  • Xcode 27 on macOS 27.0 in the reported environment
  • SwiftUI previews targeting the iOS 27.0 Simulator
  • A relatively large app target linking multiple first-party frameworks, Swift packages, and third-party SDKs
  • The default JIT-based preview execution path

The reporter also saw the issue in Xcode 26, so it has not been established as an Xcode 27-only regression. As of September 28, 2026, Apple has not identified a fixed Xcode version.

Recommended diagnostic steps

  1. Build normally: Run Product > Build and verify that compilation and linking succeed.
  2. Run the app: Launch it in the Simulator or on a device. If the app itself crashes in the same code, investigate it as an application crash rather than a preview-only failure.
  3. Try unrelated views: If several small, unrelated views fail with the same XCPreviewAgent signature, the problem is less likely to be limited to one view implementation.
  4. Inspect preview crash reports: Open XCPreviewAgent-*.ips files in ~/Library/Logs/DiagnosticReports/ and compare the crashing frames with the signatures above.
  5. Isolate dependencies: On a test branch, remove packages or frameworks one at a time and record whether the same signature remains.

Temporary ways to keep working

1. Try Legacy Preview Execution

The forum reporter found that enabling Use Legacy Preview Execution in the preview settings avoided the crash. This is a reporter-verified workaround for that environment, not an Apple-confirmed fix for every project. Restart the canvas after changing the setting and render the same view again.

2. Test the screen in the Simulator or on a device

If legacy execution also fails, use the normal Run workflow and navigate to the affected screen. A preview-only crash does not necessarily block building, testing, or distributing the app.

3. Build a minimal reproduction

Start with a new project and add the affected view and dependencies incrementally. A small reproducer gives Apple a better chance of identifying the cause and avoids submitting an entire proprietary application.

How Apple recommends collecting diagnostics

  1. Use Apple’s Profiles and Logs page to find the Swift Previews logging profile and install it on the Mac involved.
  2. Reproduce the failure.
  3. Click Diagnostics in the error banner, or open Editor > Canvas > Diagnostics.
  4. Click Generate Report and retain the resulting previews-diagnostics-*.zip.
  5. Submit the archive through Feedback Assistant. When possible, also attach a minimal reproduction and a sysdiagnose from the Mac and any physical preview device.

How to verify recovery

  • The canvas renders with the standard preview execution mode restored.
  • No new XCPreviewAgent-*.ips report is generated.
  • Multiple unrelated SwiftUI views preview reliably.
  • Normal builds and Simulator or device runs remain successful.

Cautions

  • This is not a problem that can be proven to resolve merely by deleting Derived Data. If it returns, prioritize collecting diagnostics.
  • Do not automatically blame a third-party SDK. In the original report, removing one unrelated SDK did not eliminate the crash.
  • Legacy Preview Execution is a temporary workaround. Retest the standard path after each Xcode update.
  • No fixed version has been officially confirmed. Check the Feedback Assistant resolution and current Xcode release notes.

Summary

When XCPreviewAgent: EXC_BAD_ACCESS (SIGSEGV) occurs only in previews, first separate it from an app runtime crash. Use Legacy Preview Execution or a normal Simulator run to continue working, then follow Apple’s guidance to submit preview diagnostics, a minimal reproduction, and sysdiagnose data so the underlying issue can be investigated.

Official references