Hi, I recently updated my Xcode, and I've been experiencing frequent crashes with the preview. Here’s a screenshot of the preview:
https://ibb.co/WnwWMjh
Xcode Previews
RSS for tagCreate an app UI and configure almost everything your users see using Xcode Previews.
Posts under Xcode Previews tag
148 Posts
Sort by:
Post
Replies
Boosts
Views
Activity
Hello!
My company makes use of SSL interception for its managed laptops (for various information security reasons). We've yet to find a good solution to avoid SSL cert errors in the Xcode Preview app. We've successfully installed/trusted our certs in the Xcode Simulator, but can't find any information on how to do the equivalent for the Xcode Preview. The inability to make use of the Preview App profoundly impacts productivity.
It appears the Xcode Preview doesn't share the same certificate store as the Simulator, nor does it make use of the Mac's system keychain (where the certificates are also installed and trusted). If there’s anyone you can think of who might know a way around this issue it would be greatly appreciated.
Many thanks!
After updated MAC OS I am getting this error in swift version 16.0 and MAC OS VERSION 15.0.1
note: Disabling previews because SWIFT_VERSION is set and SWIFT_OPTIMIZATION_LEVEL=-O, expected -Onone (in target 'Closures' from project 'Pods')
I am working on transitioning an existing UIKit based app to SwiftUI. After adding a first SwiftUI file to the project preview fails with:
Failed to launch app "MyApp.app" in reasonable time
The View code is the default templates, thus definitly not too complex:
import SwiftUI
struct OverviewPageView: View {
var body: some View {
Text("Hello, World!")
}
}
#Preview {
OverviewPageView()
}
Things I have tried:
Cleaning and rebuilding.
Changing the target device.
Using xcrun simctl shutdown all followed by scrub simctl erase all
Clearing the contents of my ~/Library/Developer/Xcode/UserData/Previews folder.
Clearing the contents of my ~/Library/Developer/Xcode/DerivedDatas folder.
Using xcrun simctl --set previews delete all
Restarting macOS and Xcode
The problem seems tpbe related to my project. When creating a fresh new project using "Storyboard" as interface and adding a SwiftUI file, the preview works fine. However, this does not help when working on my existing project...
I generated a preview diagnostics report.
I am using Xcode 16.0 on macOS 15.0
Bonjour,
Je me permet d'écrire un message car je rencontre un souci avec la vue canvas j'ai le message d'erreur suivant " CrashReportError: XCPreviewAgent crashed because Adjust.framework is missing" je ne sais pas trop comment identifié le problème j'utilise pod
En vous remerciant par avance
I’ve noticed a strange bug in Xcode 16 and Swift. When a preview is rendering and hasn’t finished yet and you run an app to debug, Xcode is launching two instances of the app. Has anyone else noticed this issue? If you let the preview finish rendering before running the app, this doesn’t happen. Very odd.
I’ve noticed a strange bug in Xcode 16 and Swift. When a preview is rendering and hasn’t finished yet and you run an app to debug, Xcode is launching two instances of the app. Has anyone else noticed this issue? If you let the preview finish rendering before running the app, this doesn’t happen. Very odd.
I have a project with a single asset image. In the dependency package, I am attempting to preview using the image in the project using Bundle.main. I just get a blank.
How can I get this to work?
Sample project here: https://github.com/AaronBratcher/SwiftUIPreviewProblem
I’ve recently begun learning how to utilize Xcode. I have an app in Xcode that closely resembles the iOS App template. Whenever I initiate a build, it successfully completes, but it never finishes installing views into the iOS Simulator. This issue is also present when I attempt to preview the app within the Xcode editor.
I am currently using a 2020 MacBook Air (M1). Have you encountered a similar problem? If so, how did you resolve it?
[Written using Apple Inteligence Writing Tools]
"Can not preview in this file"
Xcode 16.0
iPhone 14 Pro , iOS 18.0
When I choose to start Preview on my iPhone, the canvas screen keeps showing loading circle animation. The iPhone enters the Xcode Previews App but only displays the default screen (Xcode icon& 'Preview from Xcode')
I uploaded the some of diagnostics files
previews_diagnostics_summary.txt
remote_injection.json
I have updated my firebase with the latest version, but on simulator, apple log in and parsing from firebase server is not working on iOS 18 when working fine on the actual test device. However iOS 17 simulator works perfect as X-Code 15.
And previews are not working as well with my current app coding, which was coded in previous X-code 15.
Is there any API changes? Any help?
Or 18.1 might fix this bug?
Here's a concise post for the Apple Developer Forums:
Title: Swift Macro for SwiftUI Previews Not Recognized in Xcode
Hello everyone,
I've developed a Swift macro swift-inject-preview that generates SwiftUI previews (PreviewProvider or #Preview). However, Xcode seems to ignore the previews generated by the macro, likely because it searches for PreviewProvider/#Preview or similar text in the file before macro expansion.
Has anyone encountered a similar issue or found a workaround for getting Xcode to recognize previews created through Swift macros?
Any help or insight would be greatly appreciated!
Thank you!
Daniil Voidilov
In the latest version of Xcode, breakpoints are not displaying correctly, making it difficult to track code behavior. Previously, Xcode allowed you to step through each function, showing clear execution steps and allowing interaction to debug effectively. However, now it only shows memory addresses without providing meaningful insights, limiting the ability to interact with or test the code as it's being developed. Is anyone else experiencing this issue, or does anyone know of a workaround?
While I am able to use #Preview to preview a Widget, it seems to be not possible to easily preview a Widget placeholder. With a "classic" preview I can use .redacted(reason: .placeholder), but this has limitation e.g. it will ignore .contentMarginsDisabled()
struct MyWidget_Previews: PreviewProvider {
static var previews: some View {
Group {
MyWidgetView(entry: SimpleEntry(date: .now, emoji: "😀"))
MyWidgetView(entry: SimpleEntry(date: .now, emoji: "😀"))
.redacted(reason: .placeholder)
}
.previewContext(WidgetPreviewContext(family: .systemMedium))
.containerBackground(.white, for: .widget)
}
}
If I use #Preview, the .redacted modifier won't work, and I seem to have to put it in the MyWidget implementation.
#Preview(as: .systemMedium) {
MyWidget()
} timeline: {
SimpleEntry(date: .now, emoji: "😀")
SimpleEntry(date: .now, emoji: "🤩")
}
Am I missing something?
In XCode 16, there's the Canvas section within Editor.
This is XCode 16.1 beta. "Canvas" subitem appears in Search but does not appear under Editor section
Previews do not work for me without using Legacy Previews Extension, so I can no longer use Previews at all with XCode 16.1 Beta.
Why was Canvas subsection under Editor removed?c
Hi.
Just update my MacBook Pro M1 with sequoia and Xcode and I got huge problem with preview on simply swiftui pages.
This is the full report I got when the preview crash but if I run the app on the device or the simulator it works fine. How can I solve this situation?
the crashing thread is number 6 which reports this:
Thread 6 Crashed:: Dispatch queue: com.apple.root.user-initiated-qos
0 XOJIT 0x240b899f8 llvm::Error llvm::detail::UniqueFunctionBase<llvm::Error, llvm::jitlink::LinkGraph&>::CallImpl<xojit::ReplacementManager::Plugin::modifyPassConfig(llvm::orc::MaterializationResponsibility&, llvm::jitlink::LinkGraph&, llvm::jitlink::PassConfiguration&)::'lambda'(llvm::jitlink::LinkGraph&)>(void*, llvm::jitlink::LinkGraph&) + 1784
1 XOJIT 0x240c1b46c llvm::jitlink::JITLinkerBase::runPasses(std::__1::vector<llvm::unique_function<llvm::Error (llvm::jitlink::LinkGraph&)>, std::__1::allocator<llvm::unique_function<llvm::Error (llvm::jitlink::LinkGraph&)>>>&) + 76
2 XOJIT 0x240c1ab68 llvm::jitlink::JITLinkerBase::linkPhase1(std::__1::unique_ptr<llvm::jitlink::JITLinkerBase, std::__1::default_delete<llvm::jitlink::JITLinkerBase>>) + 72
3 XOJIT 0x240c2158c llvm::jitlink::link_MachO_arm64(std::__1::unique_ptr<llvm::jitlink::LinkGraph, std::__1::default_delete<llvm::jitlink::LinkGraph>>, std::__1::unique_ptr<llvm::jitlink::JITLinkContext, std::__1::default_delete<llvm::jitlink::JITLinkContext>>) + 3608
4 XOJIT 0x240c20400 llvm::jitlink::link_MachO(std::__1::unique_ptr<llvm::jitlink::LinkGraph, std::__1::default_delete<llvm::jitlink::LinkGraph>>, std::__1::unique_ptr<llvm::jitlink::JITLinkContext, std::__1::default_delete<llvm::jitlink::JITLinkContext>>) + 72
5 XOJIT 0x240c19cc8 llvm::jitlink::link(std::__1::unique_ptr<llvm::jitlink::LinkGraph, std::__1::default_delete<llvm::jitlink::LinkGraph>>, std::__1::unique_ptr<llvm::jitlink::JITLinkContext, std::__1::default_delete<llvm::jitlink::JITLinkContext>>) + 80
6 XOJIT 0x240c0acc0 llvm::orc::ObjectLinkingLayer::emit(std::__1::unique_ptr<llvm::orc::MaterializationResponsibility, std::__1::default_delete<llvm::orc::MaterializationResponsibility>>, std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>) + 256
7 XOJIT 0x240bfcbfc llvm::orc::BasicObjectLayerMaterializationUnit::materialize(std::__1::unique_ptr<llvm::orc::MaterializationResponsibility, std::__1::default_delete<llvm::orc::MaterializationResponsibility>>) + 60
8 XOJIT 0x240be3f08 llvm::orc::MaterializationTask::run() + 44
9 XOJIT 0x240b97e1c invocation function for block in (anonymous namespace)::GCDTaskDispatcher::dispatch(std::__1::unique_ptr<llvm::orc::Task, std::__1::default_delete<llvm::orc::Task>>) + 108
10 libdispatch.dylib 0x1801774ec _dispatch_call_block_and_release + 24
11 libdispatch.dylib 0x180178de0 _dispatch_client_callout + 16
12 libdispatch.dylib 0x18018b864 _dispatch_root_queue_drain + 1208
13 libdispatch.dylib 0x18018bf60 _dispatch_worker_thread2 + 232
14 libsystem_pthread.dylib 0x104db7b38 _pthread_wqthread + 224
15 libsystem_pthread.dylib 0x104db6934 start_wqthread + 8
Full Report
I want to add SwiftUI to an existing package. Super simple to get started. It previews with Xcode 15.4, but gives an error on Xcode 16.0: JITError: Runtime linking failure
Anyone have an idea on what may be failing?
Full SwiftUI code:
import SwiftUI
struct Dashboard: View {
var body: some View {
Text("hello")
}
}
#Preview {
Dashboard()
}
AppLaunchTimeoutError: Failed to launch app ”x.app” in reasonable time
The app ”x.app” did not launch on ”iPhone 15 Pro” in 15 seconds.
it always show that error, when it show i have to apply this command on terminal
xcrun simctl --set previews delete all
but after 30 seconds, i am facing with same issue.
With the latest Xcode 16 RC version, the Live Preview on iPhone device problem has been fixed.
However, it still fails on the iPhone 16 pro preview emulator even for the simplest hello world view.
Apparently in Xcode 16, introducing any 3rdParty package impacts the preview build, even if the package is not referenced in the view.
I feel this is an incorrect behaviour.
Following are the steps to reproduce the problem:
Create a new iOS project in the latest Xcode 16 beta
Select ContentView in the project and verify the live preview is working and fast
Go the project’s Package Dependencies tab, add gRPC-Swift (https://github.com/grpc/grpc-swift.git) as a 3rdParty library of this project.
Go the main project target, select General tab.
Under Frameworks, Libraries, and Embedded Content section, add “GRPC”
Go back to ContentView and verify its live preview rendering now takes very long time and eventually failed.
Select Live Preview Diagnostic, verify error message: Failed to launch app ”PreviewBug.app” in reasonable time…
I have also created a feedback to Apple: FB15110765