Post not yet marked as solved
Even though beta 3 change logs claim there's a fix for the preview error Type 'WidgetEntryPointFactory' does not conform to 'NonUIEntryPoint', it is still an issue for me consistently.
The previously accepted workaround for this issue also doesn't work for me anymore, which was: mv ~/Library/Developer/CoreSimulator/Caches/dyld{,_old} ; sudo killall -9 com.apple.CoreSimulator.CoreSimulatorService.
What's a developer to do to get the preview working again? 🤓
Full diagnostics message I get:
RemoteHumanReadableError: Type 'WidgetEntryPointFactory' does not conform to `NonUIEntryPoint` (in framework at path /System/Library/PrivateFrameworks/ChronoCore.framework/Support/WidgetPreviewsExtensionAgent.bundle)
==================================
| MessageSendFailure: Message send failure for <ServiceMessage 50: update>
Xcode: Version 14.0 beta 3 (14A5270f)
Post not yet marked as solved
Feedback is filed. Trying to look into the Core.swift.
diagnostics:
Unsupported: 'Consumer for unconverted(_StringProcessing.DSLTree._AST.Atom(ast:
----------------------------------------
CrashReportError: Fatal Error in Core.swift
UtilityScript crashed due to fatalError in Core.swift at line 77.
'try!' expression unexpectedly raised an error: Unsupported: 'Consumer for unconverted(_StringProcessing.DSLTree._AST.Atom(ast:
))'
Process: UtilityScript[3141]
Date/Time: 2022-07-02 03:56:17 +0000
Log File: <none>
Application Specific Information:
dyld [
dyld config: DYLD_LIBRARY_PATH=/Users/wangkeshijian/Library/Developer/Xcode/DerivedData/UtilityScript-frovasvohxblobefzbrrwtvqtyuu/Build/Intermediates.noindex/Previews/UtilityScript/Products/Debug DYLD_FRAMEWORK_PATH=/Users/wangkeshijian/Library/Developer/Xcode/DerivedData/UtilityScript-frovasvohxblobefzbrrwtvqtyuu/Build/Intermediates.noindex/Previews/UtilityScript/Products/Debug
]
libswiftCore.dylib [
_StringProcessing/Core.swift:77: Fatal error: 'try!' expression unexpectedly raised an error: Unsupported: 'Consumer for unconverted(_StringProcessing.DSLTree._AST.Atom(ast:
))'
/AppleInternal/Library/BuildRoots/0cc5e7ad-e86f-11ec-ac50-3e2aa58faa6a/Library/Caches/com.apple.xbs/Sources/swiftlang_overlay_Platform/swift-experimental-string-processing/Sources/_StringProcessing/ConsumerInterface.swift:200
]
When building for Preview it is using the iOS Simulator SDK and the destination selected.
When you build the Preview for one view it actually compile for the whole target. You can try it by launching the preview on one view successfully, then go to another view without making any change. That preview will appear instantaneously. So it look very similar to what's happening when launching on a simulator.
I am not sure why it needs to rebuild between the Preview and the actual simulator, any documentation / information about that would be great.
I notice that changing the simulator destination doesn't rebuild anything for the Preview.
Post not yet marked as solved
I'm trying to use Previews in a Swift Package in Xcode 14b2 but it's not working (it was working in Xcode 13). I have the following error message but I don't know how to solve it.
"XCPreviewAgent.app" must be code signed in order to use on-device previews. Check your code signing settings for the target.
com.apple.dt.UVPreviewAgent-watchOS.watchkitapp {
url: file:///Applications/Xcode-beta.app/Contents/Developer/Platforms/WatchOS.platform/Developer/Library/Xcode/Agents/XCPreviewAgent.app
version: 20.0.32.2
attributes: [
ObjectIdentifier(0x00000001638e5d18): ["OS_ACTIVITY_DT_MODE": "YES", "SQLITE_ENABLE_THREAD_ASSERTIONS": "1"],
]
}
It would be great to be able to build for Preview without having the SwiftUI Preview open. That way the preview will be ready without rebuilding when coming back to it. Any way to do that?
Steps to reproduce:
go to another file (not a view) like a view model
implement some logic and compile a few time during the implementation
go back to the preview, compilation take a lot of time because it now compile for another target I guess
Solution:
Add a shortcut in Product > Build For > Preview. That way I can compile for preview from anywhere easily.
Post not yet marked as solved
The the enhancements to Xcode Previews in Xcode 14 are very helpful.
I just had a situation where I wanted to take a screen capture of a preview of a view. Is there a built-in way to do that from Xcode, similar to taking a screen capture of the simulator screen?
I realize I can just use a system-level screen capture, but then I have to adjust the size of what I capture to the area of the view in the preview.
It would be great to just be able to have a button or shortcut and have the correct area captured.
Post not yet marked as solved
that is also appearing when I click the "I" button in the preview error banner
I am attempting to use the SwiftUI tutorial at https://developer.apple.com/tutorials/swiftui/building-lists-and-navigation (section 2)
here is the code for the view that the preview is "crashing" on:
import SwiftUI
struct LandmarkRow: View {
var landmark: Landmark
var body: some View {
HStack {
landmark.image
.resizable()
.frame(width: 50, height: 50)
Text("landmark.name")
Spacer()
}
}
}
struct LandmarkRow_Previews: PreviewProvider {
static var previews: some View {
LandmarkRow(landmark: landmarks[0])
}
}
Here is the code for the area it is having the problem:
import Foundation
var landmarks: [Landmark] = load("landmarkDelta.json")
func load<T: Decodable>(_ filename: String) -> T {
let data: Data
guard let file = Bundle.main.url(forResource: filename, withExtension: nil)
else {
fatalError("Couldn't find (filename) in main bundle.")
}
do {
data = try Data(contentsOf: file)
} catch {
fatalError("Couldn't load (filename) from main bundle:\n(error)")
}
do {
let decoder = JSONDecoder()
return try decoder.decode(T.self, from: data)
} catch {
fatalError("Couldn't parse (filename) as (T.self):\n(error)")
}
}
It is saying there is an error on line 17. Here is the line of code:
fatalError("Couldn't find (filename) in main bundle.")
Here is the code from the Tutorial:
import Foundation
var landmarks: [Landmark] = load("landmarkData.json")
func load<T: Decodable>(_ filename: String) -> T {
let data: Data
guard let file = Bundle.main.url(forResource: filename, withExtension: nil)
else {
fatalError("Couldn't find \(filename) in main bundle.")
}
do {
data = try Data(contentsOf: file)
} catch {
fatalError("Couldn't load \(filename) from main bundle:\n\(error)")
}
do {
let decoder = JSONDecoder()
return try decoder.decode(T.self, from: data)
} catch {
fatalError("Couldn't parse \(filename) as \(T.self):\n\(error)")
}
}
does anyone know what's wrong and how to fix it?
Post not yet marked as solved
Every time I work with Xcode Simulator or SwiftUI's Xcode Previews my Mac freezes and reboots. I get below report after restart:
panic(cpu 1 caller 0xffffff7fae0e7505): "Submission on work queue 33 failed due to insufficient space!\n" @IGGuC.cpp:2899
Panicked task 0xffffff95219449c0: 4 threads: pid 1358: SimMetalHost
Backtrace (CPU 1), panicked thread: 0xffffff9520c88540, Frame : Return Address
0xffffffe5a9882de0 : 0xffffff8015a81c8d
0xffffffe5a9882e30 : 0xffffff8015be1596
0xffffffe5a9882e70 : 0xffffff8015bd0963
0xffffffe5a9882ec0 : 0xffffff8015a21a70
0xffffffe5a9882ee0 : 0xffffff8015a8205d
0xffffffe5a9883000 : 0xffffff8015a81816
0xffffffe5a9883060 : 0xffffff8016315163
0xffffffe5a9883150 : 0xffffff7fae0e7505
0xffffffe5a9883160 : 0xffffff7fae05ecf7
0xffffffe5a9883250 : 0xffffff7fae084844
0xffffffe5a9883280 : 0xffffff7fae08f6e5
0xffffffe5a98832f0 : 0xffffff7fae9d75b7
0xffffffe5a9883330 : 0xffffff7fae06c73d
0xffffffe5a9883350 : 0xffffff7fae06cb5d
0xffffffe5a98833c0 : 0xffffff7fae09b89e
0xffffffe5a98835e0 : 0xffffff7fae070ed4
0xffffffe5a9883620 : 0xffffff7fae9ed118
0xffffffe5a9883650 : 0xffffff7fae070b00
0xffffffe5a9883690 : 0xffffff7fae9ed2a7
0xffffffe5a98836d0 : 0xffffff7fae9ed996
0xffffffe5a9883970 : 0xffffff7fae0714f4
0xffffffe5a98839a0 : 0xffffff7fae9ee8f1
0xffffffe5a9883a30 : 0xffffff7fae9ec94b
0xffffffe5a9883a90 : 0xffffff7fae9ec741
0xffffffe5a9883ae0 : 0xffffff7fae9eb81d
0xffffffe5a9883b20 : 0xffffff7fae071137
0xffffffe5a9883b60 : 0xffffff8016283a8c
0xffffffe5a9883cc0 : 0xffffff8015b872e6
0xffffffe5a9883dd0 : 0xffffff8015a5c9ab
0xffffffe5a9883e60 : 0xffffff8015a731f9
0xffffffe5a9883ef0 : 0xffffff8015bb35aa
0xffffffe5a9883fa0 : 0xffffff8015a22256
Kernel Extensions in backtrace:
com.apple.iokit.IOAcceleratorFamily2(462.8)[F0D1B5AF-356A-3F86-8829-8F00218602CB]@0xffffff7fae9a6000->0xffffff7faea10fff
dependency: com.apple.driver.AppleMobileFileIntegrity(1.0.5)[2B96E04B-E2A5-3296-AF14-6A766880A652]@0xffffff80171a1000->0xffffff80171c2fff
dependency: com.apple.iokit.IOGraphicsFamily(597)[BBEE13AB-2291-37D9-AAE4-9E565E8950A5]@0xffffff7faeb3f000->0xffffff7faeb6dfff
dependency: com.apple.iokit.IOPCIFamily(2.9)[654ABF9D-EB24-3B64-AB1C-EC2AC8357192]@0xffffff8018624000->0xffffff801864ffff
dependency: com.apple.iokit.IOReportFamily(47)[5578189C-7C1D-3158-B357-F8D6A216DCE1]@0xffffff8018661000->0xffffff8018663fff
dependency: com.apple.iokit.IOSurface(302.14)[F0BF8EFA-AA35-37B5-B3AB-A8BCF5E62024]@0xffffff8018794000->0xffffff80187b0fff
com.apple.driver.AppleIntelKBLGraphics(18.0.7)[1A72DE92-F799-3EFF-8AD4-B662C53C36AD]@0xffffff7fae059000->0xffffff7fae117fff
dependency: com.apple.iokit.IOAcceleratorFamily2(462.8)[F0D1B5AF-356A-3F86-8829-8F00218602CB]@0xffffff7fae9a6000->0xffffff7faea10fff
dependency: com.apple.iokit.IOGraphicsFamily(597)[BBEE13AB-2291-37D9-AAE4-9E565E8950A5]@0xffffff7faeb3f000->0xffffff7faeb6dfff
dependency: com.apple.iokit.IOPCIFamily(2.9)[654ABF9D-EB24-3B64-AB1C-EC2AC8357192]@0xffffff8018624000->0xffffff801864ffff
dependency: com.apple.iokit.IOSurface(302.14)[F0BF8EFA-AA35-37B5-B3AB-A8BCF5E62024]@0xffffff8018794000->0xffffff80187b0fff
Process name corresponding to current thread (0xffffff9520c88540): SimMetalHost (iPhone 12: default
Boot args: chunklist-security-epoch=0 -chunklist-no-rev2-dev chunklist-security-epoch=0 -chunklist-no-rev2-dev
Mac OS version:
21F79
Kernel version:
Darwin Kernel Version 21.5.0: Tue Apr 26 21:08:22 PDT 2022; root:xnu-8020.121.3~4/RELEASE_X86_64
Kernel UUID: 3C587984-4004-3C76-8ADF-997822977184
KernelCache slide: 0x0000000015800000
KernelCache base: 0xffffff8015a00000
Kernel slide: 0x0000000015810000
Kernel text base: 0xffffff8015a10000
__HIB text base: 0xffffff8015900000
System model name: Macmini8,1 (Mac-7BA5B2DFE22DDD8C)
System shutdown begun: NO
Hibernation exit count: 0
System uptime in nanoseconds: 2335401059040
Last Sleep: absolute base_tsc base_nano
Uptime : 0x0000021fc0c0295e
Sleep : 0x000000c429fd13d9 0x00000000bae420b6 0x000000a6581a552b
Wake : 0x000000c435bb1b42 0x00000000bae11627 0x000000c4332c18c2
Compressor Info: 24% of compressed pages limit (OK) and 12% of segments limit (OK) with 5 swapfiles and OK swap space
Zone info:
Zone map: 0xffffff805595c000 - 0xffffffa05595c000
. PGZ : 0xffffff805595c000 - 0xffffff805695d000
. VM : 0xffffff805695d000 - 0xffffff85233c3000
. RO : 0xffffff85233c3000 - 0xffffff86bcc8f000
. GEN0 : 0xffffff86bcc8f000 - 0xffffff8b896f5000
. GEN1 : 0xffffff8b896f5000 - 0xffffff905615b000
. GEN2 : 0xffffff905615b000 - 0xffffff9522bc1000
. GEN3 : 0xffffff9522bc1000 - 0xffffff99ef628000
. DATA : 0xffffff99ef628000 - 0xffffffa05595c000
Metadata: 0xffffffa079aee000 - 0xffffffa099aee000
Bitmaps : 0xffffffa099aee000 - 0xffffffa09caee000
last started kext at 1655076280961: >usb.cdc.acm 5.0.0 (addr 0xffffff7fae81d000, size 12288)
last stopped kext at 1766102575761: >usb.serial 6.0.0 (addr 0xffffff7fae893000, size 20480)
loaded kexts:
AGPM 129
!APlatformEnabler 2.7.0d0
X86PlatformShim 1.0.0
@filesystems.autofs 3.0
!AGFXHDA 140.3
!AUpstreamUserClient 3.6.9
!AMCCSControl 1.16
!ABridgeAudio!C 240.6
!AGraphicsDevicePolicy 6.5.7
BridgeAudioCommunication 240.6
!AAVEBridge 6.1
!A!IKBLGraphics 18.0.7
@AGDCPluginDisplayMetrics 6.5.7
pmtelemetry 1
!A!ICFLGraphicsFramebuffer 18.0.7
|IOUserEthernet 1.0.1
usb.!UUserHCI 1
!A!IPCHPMC 2.0.1
!AHV 1
!ADiskImages2 126.100.13
!A!ISlowAdaptiveClocking 4.0.0
!AThunderboltIP 4.0.3
BCMWLANFirmware4387.Hashstore 1
BCMWLANFirmware4378.Hashstore 1
BCMWLANFirmware4377.Hashstore 1
BCMWLANFirmware4364.Hashstore 1
BCMWLANFirmware4355.Hashstore 1
!AFileSystemDriver 3.0.1
@filesystems.tmpfs 1
@filesystems.lifs 1
@filesystems.hfs.kext 583.100.10
@BootCache 40
@!AFSCompression.!AFSCompressionTypeZlib 1.0.0
@!AFSCompression.!AFSCompressionTypeDataless 1.0.0d1
@filesystems.apfs 1934.121.2
!ABCMWLANBusInterfacePCIeMac 1
!ASDXC 3.2.1
|!ABCM5701Ethernet 11.0.0
@private.KextAudit 1.0
!AACPIButtons 6.1
!ASMBIOS 2.1
!AACPIEC 6.1
!AAPIC 1.7
@!ASystemPolicy 2.0.0
@nke.applicationfirewall 402
|IOKitRegistryCompatibility 1
|EndpointSecurity 1
@Dont_Steal_Mac_OS_X 7.0.0
@kec.!AEncryptedArchive 1
!UMergeNub 900.4.2
IO!BHIDDriver 9.0.0
driverkit.serial 6.0.0
@kext.triggers 1.0
!ASMBus!C 1.0.18d1
!AAudioClockLibs 140.1
!A!ILpssUARTv1 3.0.60
!A!ILpssUARTCommon 3.0.60
!AOnboardSerial 1.0
usb.IOUSBHostHIDDevice 1.2
|IOAudio!F 340.2
@vecLib.kext 1.2.0
!AGraphicsControl 6.5.7
|IONDRVSupport 597
X86PlatformPlugin 1.0.0
..............
Below is my system configuration:
Model Name: Mac mini
Model Identifier: Macmini8,1
Processor Name: 6-Core Intel Core i5
Processor Speed: 3 GHz
Number of Processors: 1
Total Number of Cores: 6
Memory: 8 GB
System Version: macOS 12.4 (21F79)
Any help would be appreciated, thanks!
I'm trying out weather kit and I'm using swiftUI
I have a view that accepts a CurrentWeather type value in initailizer
I cannot find a way to initialize a CurrentWeather
How can I preview It?
This won't work:
// forecaster and forecast is defined by me
struct WeatherView_Previews: PreviewProvider {
static var previews: some View { // <- static
WeatherView(weather: await forecaster.forcast(latitude: 0, longtitude: 0)) // <- concurrency
}
}
Post not yet marked as solved
In Xcode 13, I can use groups to preview my views in different states:
In Xcode 14 (Beta 1) groups are now rendered as tabs, making it way more difficult to verify all states after changes:
Is there a way to toggle back to the old behavior - or is there any other container view that would be more suitable?
It says there's an error uploading the image so I can't get a image up here in a moment
EDIT AFTER RESTARTING SAFARI:
Oh no still won't work
Post not yet marked as solved
Hello :)
My iOS project does not work with SwiftUI Preview in Xcode 14 beta. The project builds and runs fine, but Preview never works. The error message is as follows.
HumanReadableSwiftError
SettingsError: noExecutablePath(<IDESwiftPackageStaticLibraryProductBuildable:ObjectIdentifier(0x000060002ac3e880):'AppCenterCrashes'>)
I do use the AppCenterCrashes dependency in my project. But I'm not sure if this error message is accurate, because sometimes it reports other packages.
After I executed Generate Report, I found the following error in SerializationErrors.txt.
Error Domain=NSCocoaErrorDomain Code=516 "“LogCaffeineIntent.swift” couldn’t be linked to “Intermediates” because an item with the same name already exists." UserInfo={NSSourceFilePathErrorKey=/Users/gong/Library/Developer/Xcode/DerivedData/.../Build/Intermediates.noindex/HiCoffee.build/Debug-iphonesimulator/IntentsExtension.build/DerivedSources/IntentDefinitionGenerated/Intents/LogCaffeineIntent.swift, NSUserStringVariant=(
Link
), NSDestinationFilePath=/var/folders/lv/58r5dhv52j779_qn41gnq4c80000gn/T/previews-diagnostics-20220608-144336/Intermediates/LogCaffeineIntent.swift, NSFilePath=/Users/gong/Library/Developer/Xcode/DerivedData/.../Build/Intermediates.noindex/HiCoffee.build/Debug-iphonesimulator/IntentsExtension.build/DerivedSources/IntentDefinitionGenerated/Intents/LogCaffeineIntent.swift, NSUnderlyingError=0x600033223810 {Error Domain=NSPOSIXErrorDomain Code=17 "File exists"}}
The problem seems to be related to the Intent generation code. I don't know how to fix it yet.
Post not yet marked as solved
Following the sample notes at https://developer.apple.com/documentation/widgetkit/creating-lock-screen-widgets-and-watch-complications, when I try to preview the Watch widget, I get an error saying:
Cannot preview in this file
WidgetEntryPointFactory' does not conform to NonUIEntryPoint
RemoteHumanReadableError: Type 'WidgetEntryPointFactory' does not conform to NonUIEntryPoint (in framework at path /System/Library/PrivateFrameworks/ChronoCore.framework/Support/WidgetPreviewsExtensionAgent.bundle)
==================================
| MessageSendFailure: Message send failure for <ServiceMessage 187: update>
App widgets preview fine though.
Am I doing something obviously wrong?
Post not yet marked as solved
As some discussion suggested (https://developer.apple.com/forums/thread/683773), that the Live Preview debug function has been removed from Xcode 13 for some reason.
I wonder what would be the best practice to debug a SwfitUI View when we have not yet established a path from the App's entry point to this View?
Post not yet marked as solved
Hello,
I'm new to the xCode so the question might seem trivial.
However I haven't came across any solutions to my problem and tried literally everything.
I'm not able to preview any content on the canvas. Keep getting an error saying:
FailedToConnectToDTServiceHubError: Cannot connect to iPhone 12
Try disconnecting and reconnecting the device.
iPhone 12 {
}: connection attempt #1154
It's not the matter of previewing it on any device just wish to preview it inside the editor so I can work faster. The simulator is working just fine.
Please, did anybody experience any similar issues?
I can provide a report of the issue for the further verification.
Kind regards,
Hugo Czerniawski
I use the screen size for some SwiftUI view layouts to adapt to various screen sizes. I have found that for some devices, such as the iPhone 13 mini, the screen size returned from UIScreen.main.bounds differs from the preview device and the simulator. Is this expected behavior?
Post not yet marked as solved
Hi, i’m fairly new to Xcode. That aside, running the pre written code on previews which only prints “hello world” Gives me a “TimeoutError: Timed out waiting for connection to DTServiceHub after 15.0 seconds.”How can i fix this? I really wanna try out the visual editor.
Post not yet marked as solved
When I open a new project in Xcode and run the preview the preview fails and I get the message “expected ‘{‘ in struct”. This is before I enter any new code
Post not yet marked as solved
How can I write multi type of modifiers? I used this code and got error
struct LibraryContent: LibraryContentProvider {
func modifiers(base: Image) -> [LibraryItem] {
LibraryItem(
base.resizedToFill(width: 100.0, height: 100.0),
title: "Image Resize To Fill",
category: .layout
)
LibraryItem(
base.normalText(font: .title2, weight: .bold),
title: "Text Normal",
category: .layout
)
}
}
extension Image {
func resizedToFill(width: CGFloat, height: CGFloat) -> some View {
self
.resizable()
.aspectRatio(contentMode: .fill)
.frame(width: width, height: height)
}
}
extension Text {
func normalText(font: Font, weight: Font.Weight) -> some View {
self
.font(font)
.fontWeight(weight)
}
}