Xcode Previews

RSS for tag

Create an app UI and configure almost everything your users see using Xcode Previews.

Xcode Previews Documentation

Posts under Xcode Previews tag

124 Posts
Sort by:
Post not yet marked as solved
2 Replies
305 Views
I have a project that runs smoothly and works on the Simulator, but does not render on the Canvas. Neither the Live Preview nor the view on the Canvas works and aborts with the error: MessageSendFailure: Message send failure for relaunch. I have attached the error log for you. I hope you guys can help me out. It sucks to work like this. By the way, it's not because of the swift file. Also with new SwiftUI views the error comes. What have I tried so far: reinstall xCode Clear build cache Create a new project Thanks for your help! previews_diagnostics_summary.txt
Posted
by
Post marked as solved
1 Replies
255 Views
Previews don't work when are inside of a static framework. Has anyone experimented it also? MessageSendFailure: Message send failure for update ================================== |  RemoteHumanReadableError: Unknown preview provider "Provider_Previews_" |   |  XCPreviewAgent does not contain a preview provider named "Provider_Previews_". Check your build settings to ensure the preview provider is compiled into your product. |   |  Mangled name: 0012Provider_0021Provider_Previews_V Thanks in advance
Posted
by
Post marked as solved
1 Replies
227 Views
One more similar to the previous problem. When I clicked the Resume button in the Preview section one hour ago... I have been still observing the process of "Preparing iPhone Simulator for Previews". Probably not developers but creators of xCode should support me and others to find a global solution... I would like to mention that the same process works properly when I use it for the Mac app development
Posted
by
Post marked as solved
2 Replies
251 Views
Hi guys, when I trzy to build an app using SwiftUI the preview preparation lasts for a very long time and finally I see a message about timeout: Timed out waiting for connection to DTService after 15.0 seconds. In addition it appears a window with the second one that the app MobileCal quit working unexpectedly. So I don’t know what to do. I would like to learn and use SwiftUI. In Building apps for Mac has been working properly but for iOS it is the Mission Impossible….
Posted
by
Post not yet marked as solved
1 Replies
196 Views
Hi all, I'm trying to preview a very simple view in a project I have in SwiftUI, and I'm getting this error regardless of the view I'm trying to preview: ---------------------------------------- LinkDylibError: Failed to build PreferencesView.swift Linking failed: linker command failed with exit code 1 (use -v to see invocation) ld: warning: directory not found for option '-F/Applications/Xcode-13.3.1.app/Contents/SharedFrameworks-iphonesimulator' Undefined symbols for architecture x86_64: "___asan_init", referenced from: _asan.module_ctor in Pods_Remoti(Pods-Remoti-dummy.o) "___asan_version_mismatch_check_apple_clang_1316", referenced from: _asan.module_ctor in Pods_Remoti(Pods-Remoti-dummy.o) ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) ================================== (I'm attaching the whole error in the post, because it's way too long) Am I doing something wrong here? Thanks in advance!
Posted
by
Post not yet marked as solved
0 Replies
263 Views
Hello, I am building game with SpriteKit. 2 or 3 days ago my code worked perfectly then some project files paths changed in my computer. So now my code is running on preview but it's not running on simulator. I got error message like this Thread 1: signal SIGABRT 2022-04-17 23:48:25.927505+0300 MultiplayerGame[58416:1308997] fopen failed for data file: errno = 2 (No such file or directory) 2022-04-17 23:48:25.927569+0300 MultiplayerGame[58416:1308997] Errors found! Invalidating cache... 2022-04-17 23:48:26.015933+0300 MultiplayerGame[58416:1309280] Execution of the command buffer was aborted due to an error during execution. The operation couldn’t be completed. (MTLCommandBufferErrorDomain error 9.) 2022-04-17 23:48:26.016392+0300 MultiplayerGame[58416:1309280] Execution of the command buffer was aborted due to an error during execution. The operation couldn’t be completed. (MTLCommandBufferErrorDomain error 9.) XPC_ERROR_CONNECTION_INTERRUPTED dyld4 config: DYLD_ROOT_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot DYLD_LIBRARY_PATH=/Users/mkg/Library/Developer/Xcode/DerivedData/MultiplayerGame-ghupaqvlksldiogzatxbetsvshfx/Build/Products/Debug-iphonesimulator:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/introspection DYLD_INSERT_LIBRARIES=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libBacktraceRecording.dylib:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libMainThreadChecker.dylib:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libMTLCapture.dylib:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/Developer/Library/PrivateFrameworks/DTDDISupport.framework/libViewDebuggerSupport.dylib DYLD_FRAMEWORK_PATH=/Users/mkg/Library/Developer/Xcode/DerivedData/MultiplayerGame-ghupaqvlksldiogzatxbetsvshfx/Build/Products/Debug-iphonesimulator:/Users/mkg/Library/Developer/Xcode/DerivedData/MultiplayerGame-ghupaqvlksldiogzatxbetsvshfx/Build/Products/Debug-iphonesimulator/PackageFrameworks CoreSimulator 802.6 - Device: iPhone 12 Pro Max (50569CD6-26AA-45EF-BE07-3B5F9702915E) - Runtime: iOS 15.4 (19E240) - DeviceType: iPhone 12 Pro Max (lldb)
Posted
by
Post not yet marked as solved
2 Replies
221 Views
My canvas preview keeps crashing when I try to resume it. I tried restarting Xcode, my Mac, tried to change the files location, tried to change the device for the preview and nothing works. Strange thing is that the app builds successfully and runs on the simulator. I noticed that this happens when I use Source Control(GitHub) in my project. I will attach the crash log. Crash log
Posted
by
Post marked as solved
1 Replies
194 Views
I've tried to create a simple CoreData entity and use the PreviewProvider to display the results. This worked fine (The first entity that got displayed was the GoalInformation). After this i've extended my entity with a relationship to another entity. This is a screenshot from the Xcode editor: More information about the entities: This is my ContentView struct ContentView: View { @Environment(\.managedObjectContext) private var viewContext @FetchRequest( sortDescriptors: [NSSortDescriptor(keyPath: \Goal.information!.name, ascending: true)], animation: .default) private var items: FetchedResults<Goal> var body: some View { VStack { Text("count: \(items.count)") } } } struct ContentView_Previews: PreviewProvider { static var previews: some View { ContentView() .environment(\.managedObjectContext, PersistenceController.preview.container.viewContext) } } The preview of the PersistenceController looks like this: static var preview: PersistenceController = { let result = PersistenceController(inMemory: true) let viewContext = result.container.viewContext for _ in 0..<5 { let newItem = GoalInformation(context: viewContext) newItem.name = "Name" let newItem2 = Goal(context: viewContext) newItem2.information = newItem } do { try viewContext.save() } catch { let nsError = error as NSError debugPrint("\(nsError.code) + \(nsError.debugDescription)") } return result }() The init of the same struct is this: init(inMemory: Bool = false) { container = NSPersistentCloudKitContainer(name: "goalz_two") if inMemory { container.persistentStoreDescriptions.first!.url = URL(fileURLWithPath: "/dev/null") } container.loadPersistentStores(completionHandler: { (storeDescription, error) in if let error = error as NSError? { debugPrint("\(error.code) + \(error.description)") } }) } When i want to display it by clicking "Resume" this is the error I receive. Some more infos: Error Domain=FBProcessExit Code=4 "The process crashed." UserInfo={NSLocalizedFailureReason=The process crashed., BSErrorCodeDescription=crash, NSUnderlyingError=0x600002e0fc00 {Error Domain=signal Code=4 "SIGILL(4)" UserInfo={NSLocalizedFailureReason=SIGILL(4)}}} ---------------------------------------- MessageSendFailure: Message send failure for relaunch ================================== | RemoteHumanReadableError: The operation couldn’t be completed. Transaction failed. Process failed to launch. (process launch failed) | | BSTransactionError (1): | ==error-reason: process launch failed | ==transaction: <FBApplicationProcessLaunchTransaction: 0x600001931340> | ==NSLocalizedFailureReason: Transaction failed. Process failed to launch. (process launch failed) | ==precipitating-error: Error Domain=FBProcessExit Code=4 "The process crashed." UserInfo={NSLocalizedFailureReason=The process crashed., BSErrorCodeDescription=crash, NSUnderlyingError=0x600002e0fc00 {Error Domain=signal Code=4 "SIGILL(4)" UserInfo={NSLocalizedFailureReason=SIGILL(4)}}} | ==error-description: Process failed to launch. I'm so confused, because it worked when there was no relationship and i've only created one entity. Hope someone can help me out... Using Xcode Version 13.2.1 on macOS 12.3
Posted
by
Post marked as solved
1 Replies
224 Views
I have encounter a problem where my canvas cannot preview but it build successfully and runs in a simulator. I have tried: xcrun simctl --set previews delete all clean build and rebuild Is there any other suggestion or solution I can solve this issue? Xcode Version: Version 13.3 (13E113) Diagnostics: MessageSendFailure: Message send failure for relaunch ================================== |  RemoteHumanReadableError: The operation couldn’t be completed. Transaction failed. Process failed to launch. (process launch failed) |   |  BSTransactionError (1): |  ==error-description: Process failed to launch. |  ==NSLocalizedFailureReason: Transaction failed. Process failed to launch. (process launch failed) |  ==transaction: <FBApplicationProcessLaunchTransaction: 0x6000015316c0> |  ==error-reason: process launch failed |  ==precipitating-error: Error Domain=FBProcessExit Code=4 "The process crashed." UserInfo={NSLocalizedFailureReason=The process crashed., BSErrorCodeDescription=crash, NSUnderlyingError=0x60000224e670 {Error Domain=signal Code=5 "SIGTRAP(5)" UserInfo={NSLocalizedFailureReason=SIGTRAP(5)}}}
Posted
by
Post not yet marked as solved
2 Replies
206 Views
Currently working on a project these past couple of days but today when I opened Xcode and selected my project it would not display my stimulater phone and would keep refreshing showing the last successful build was sometime yesterday.
Posted
by
Post not yet marked as solved
1 Replies
322 Views
I downloaded Xcode, created a new swiftUI project for an iOS app. When I hit the preview button, it appears to be trying to do something, but it never generates the 'Hello World' preview. If I let it sit for half an hour or more, an error is eventually generated: Timeout Error: Timed out waiting for connection to DTServiceHub ater 15.0 seconds. Similarly, if I hit the build button, it will take about an hour or more for the iOS simulator to open with the 'Hello World!' app. While Xcode is working, my system becomes sluggish to the point where nothing else can be done, even though the Activity monitor doesn't show heavy CPU or memory usage. Xcode 13.3 (13E113) System: iMac 18,2 Quad-Core i5 3 GHz 8GB macOS 12.2.1 (21D62)
Posted
by
Post not yet marked as solved
3 Replies
400 Views
Hi there, after updating Xcode to 13.3 my Previews in all my Projects (with SwiftUI) stopped working. Every time i start the preview - the message send failure for capabilities - is showing up. I have reinstalled Xcode from web and App Store but nothing changed. I also deleted the "Developer Folder" in Library - nothing.. I don't know what i can do.... Thanks for your help
Posted
by
Post marked as solved
1 Replies
246 Views
Hi! I followed the Apple's SwiftUI Tutorials"LandmarksApp".But When I resume preview at "LandmarkRow.swift", landmarksApp was clashed by unexpected reason. I couldn't find why this problem was happened. Please tell me how to solve this problem. ↓My Mac details MacBookPro 13inch (2020-M1) 16GB memory,512GB SSD macOS Monterey 12.2.1, Xcode version 13.2.1
Posted
by
Post not yet marked as solved
1 Replies
383 Views
Hello I'm having a problem with the SwiftUI preview, I created a package, which has resources and I'm trying to run the preview inside the package. But the preview gives the following error: PreviewUpdateTimedOutError: Updating took more than 5 seconds Updating a preview from in XCPreviewAgent.app (6693) took more than 5 seconds. When I generate the diagnosis and see the SerializationErrors.txt it gives the following message: Error Domain=NSCocoaErrorDomain Code=516 "“resource_bundle_accessor.swift” couldn’t be linked to “Intermediates” because an item with the same name already exists." UserInfo={NSSourceFilePathErrorKey=/Users/********/Library/Developer/Xcode/DerivedData/********-glsxbeukhhwappbnunipftxmhjvi/Build/Intermediates.noindex/Previews/********/Intermediates.noindex/***** ***.build/Debug-iphonesimulator/********.build/DerivedSources/resource_bundle_accessor.swift, NSUserStringVariant=( Link ), NSDestinationFilePath=/var/folders/xt/s6r881rx7bjfcw_mds72nxyw0000gp/T/previews-diagnostics-20220304-114049/Intermediates/resource_bundle_accessor.swift, NSFilePath=/Users/*********/Library/Developer/Xcode/DerivedData /********-glsxbeukhhwappbnunipftxmhjvi/Build/Intermediates.noindex/Previews/********/Intermediates.noindex/********.build/Debug-iphonesimulator/** ******.build/DerivedSources/resource_bundle_accessor.swift, NSUnderlyingError=0x2cb1d2cd0 {Error Domain=NSPOSIXErrorDomain Code=17 "File exists"}} I've tried clearing the derivated data, clearing the preview cache, restarting the mac, nothing works... Anyone have any ideas? This package has no external dependencies
Posted
by
Post not yet marked as solved
0 Replies
281 Views
SwiftUI Previews are broken for me when one of imported Swift Package has a conditional dependency to another platform. Steps to reproduce: Create Xcode Project with 2 targets. One for macOS, another for iOS. Add a Swift Package that has a conditional dependency - eg. depends on another package but only on iOS. Example: targets: [    .target(name: "Components", dependencies: [            .productItem(name: "FloatingPanel", package: "FloatingPanel", condition: .when(platforms: [.iOS])),       ]), ] Try running SwiftUI preview on macOS. It won’t work. The error I get is no such module UIKit. It looks like Xcode is trying to build FloatingPanel dependency even though it's condition specifies iOS platform. Is there any way to fix this?
Posted
by
Post not yet marked as solved
0 Replies
275 Views
I wrote short code for the App using camera and that crushed when I tried to display preview. There is no error code, so where should I fix?     @State var image: Image?     @State var isPicking = false     var body: some View {         ZStack {             VStack {                 VStack {                         Spacer()                         image?                             .resizable()                             .scaledToFit()                         Spacer()                     }                 HStack {                     Spacer()                     Button(action: {                         self.isPicking = true                     }) {                         Image(systemName: "camera")                         Text("カメラ")                     }.padding()                 }             }             if isPicking {                 ImagePicker()                     .edgesIgnoringSafeArea(.all)                     .transition(.move(edge: .bottom))                     .animation(.easeInOut, value: isPicking)             }         }     } } struct ContentView_Previews: PreviewProvider {     static var previews: some View {         ContentView()     } } ImagePicker↓ struct ImagePicker: UIViewControllerRepresentable{         func makeCoordinator() -&gt; Coordinator {       Coordinator(self)     }          func makeUIViewController(context: Context) -&gt;     UIImagePickerController{         let picker = UIImagePickerController()         picker.sourceType = .camera         picker.delegate = context.coordinator         return picker     }          func updateUIViewController(_ uiViewController: UIImagePickerController, context: Context) {     } } struct ImagePicker_Previews: PreviewProvider {     static var previews: some View {         ImagePicker()     } } Coordinator↓ class Coordinator: NSObject, UINavigationControllerDelegate, UIImagePickerControllerDelegate{     var parent: ImagePicker     init(_ parent: ImagePicker){         self.parent = parent     }  func imagePickerController(_ picker: UIImagePickerController,                            didFinishPickingMediaWithInfo info:                                        [UIImagePickerController.InfoKey: Any]){     let uiImage = info[.originalImage] as! UIImage     UIImageWriteToSavedPhotosAlbum(uiImage, nil, nil, nil) } func imagePickerControllerDidCancel(_ picker: UIImagePickerController){ } }
Posted
by
Post not yet marked as solved
1 Replies
214 Views
Xcode SwiftUI previews were a godsend, increasing my productivity by 1000x with use cases like this: Preview a UIViewController (via UIViewControllerRepresentable) Update view controller code and see changes to previews in real time Update theme files (colors, styles) and see changes to previews in real time This all used to work like a charm as long as the updated code was inside functions or computed properties. But starting with Xcode 13.2, it no longer works: Updating any file outside of PreviewProvider struct just reloads the canvas, but does not account for changes in these files (e.g. if I change color in a theme file, the old color will be shown in preview until I pause the preview, recompile and reload preview) Using "Refresh Canvas" does not solve the issue (it just reloads the canvas with stale data) Any way to fix this?
Posted
by
Post not yet marked as solved
1 Replies
265 Views
Help for some reason this app called xCode previews and every time I restart it appears on my Home Screen how do I permenently take it off my Home Screen it’s so annoying
Posted
by