Post

Replies

Boosts

Views

Activity

Issues with NSBundle failed, VTParavirtualization, IOServiceMatchingFailed, AppleM2ScalerParavirtDriver
I'm building an app in Apple Virtualization but I can no longer generate images after updating to macOS Sequoia. It's a simple function that will create thumbnails in either HEIF or JPEG, but neither work now. I get these warnings every time: CGImageProviderGetContentHeadroom: Bad headroom value 0.000000 for SDR, returning 1.0 NSBundle file:///System/Library/PrivateFrameworks/MetalTools.framework/ principal class is nil because all fallbacks have failed IOServiceMatchingfailed for: AppleM2ScalerParavirtDriver <<<< VTParavirtualization >>>> VTParavirtualizationReplyClerkWaitForReply signalled err=-19092 (kVTParavirtualizationTimeoutErr) (timeout waiting for pending reply) at VTParavirtualization. c: 3804 writeImageAtIndex:1077: *** CMPhotoCompressionSessionAddImage: err = unknown error [-19092] (codec: 'hvc1') The operation couldn't be completed. (CINonLocalizedDescriptionKey error 3.) Will this be resolved in Xcode 16 or macOS Sequoia?
3
2
3.6k
Jul ’24
SwiftData History crashes when fetching transactions
Some of my models have many-to-many relationships. For example, when I add a file to a directory, a model is created from that in addition to any relationships it may contain. I’ve incorporated SwiftData History into my front end and backend projects and it’s able to show me what has been inserted, updated, and even deleted after the file is removed from the directory. Which only returns the identifiers I’ve set to become tombstone values. All working as expected and my client can now sync with the server. I can add and remove the same file repeatedly and I’m able to retrieve all the transactions. However if I add another file and then fetch transactions, it crashes at .fetchHistory(_:). The errors say they cannot find the property of a model it has a many-to-many relationship with. I omitted appending any relationships, but the errors start pointing to properties belonging to the model itself. I’ve only managed to get this functioning by setting the @Relationship macro to a single model. Previously, I had this macro with its delete rule and inverse on other types. But doing so would crash the same way immediately and wouldn’t let me fetch history at all. Since it crashes at fetching the history, I’m unable to proceed and the options appear to be limited for what I can do before I fetch them. Does SwiftData History not work with many-to-many relationships or is this a bug?
0
0
305
Aug ’24
Previews due to SwiftData Predicates in Xcode 16.3
My preview crashes whenever I compare my model's value to a constant's stored value. I use struct constants with a stored value as alternatives to enums, (IIRC ever since the beginning) enums never worked at all with .rawValue or computed properties. This crashes when it runs on Xcode 16.3 beta and iOS 18.4 in previews. It doesn't appear to crash in simulator. @Model class Media { @Attribute(.unique) var id: UUID = UUID() @Attribute var type: MediaType init(type: MediaType) { self.type = type } static var predicate: (Predicate<Media>) { let image = MediaType.image.value let predicate = #Predicate<Media> { media in media.type.value == image } return predicate } } struct MediaType: Codable, Equatable, Hashable { static let image: MediaType = .init(value: 0) static let video: MediaType = .init(value: 1) static let audio: MediaType = .init(value: 2) var value: Int } My application crashes with "Application crashed due to fatalError in Schema.swift at line 320." KeyPath \Media.<computed 0x000000034082a33c (MediaType)>.value points to a field (<computed 0x000000034082a33c (MediaType)>) that is unknown to Media and cannot be used. This appears to also occur if I am using a generic/any func and use protocols to access a property which is a simple String, such as id or name, despite it being a stored SwiftData attribute. I filed a bug report, but looking to hear workarounds.
4
0
600
Mar ’25
Feedback/issues for SwiftData custom store
Hello, thank you Apple for supporting custom store with SwiftData and the Schema type is superb to work with. I have successfully set one up with SQL and have some feedback and issues regarding its APIs. There’s a highlighted message in the documentation about not using internal restricted symbols directly, but they contradict with the given protocols and I am concerned about breaking any App Store rules. Are we allowed to use these? If not, they should be opened up as they’re useful. BackingData is required to set up custom snapshots, initialization, and getting/setting values. And I want to use it with createBackingData() to directly initialize instances from snapshots when transferring them between server and client or concurrency. RelationshipCollection for casting to-many relationships from backing data or checking if an array contains a PersistentModel. SchemaProperty for type erasure in a collection. Schema.Relationship has KeyPath properties, but it is missing for Schema.Attribute and Schema.CompositeAttribute. Which means you can’t purely depend on the schema to map data. I am unable to access the properties of a custom struct type in a predicate unless I use Mirror with schemaMetadata() or CustomStringConvertible on the KeyPath directly to extract it. Trivial, but… the KeyPath property name is inconsistent (it’s all lowercase). It would be nice to retrieve property names from custom struct types, since you are unable access CodingKeys that are auto synthesized by Codable for structs. But I recently realized they’re a part Schema.CompositeAttribute, however I don’t know how to match these without the KeyPath… I currently map my entities using CodingKeys to their PredicateCodableKeyPathProviding.… but I wish for a simpler alternative! It’s unclear how to provide the schema to the snapshot before new models are created. I currently use a static property, but I want to make it flexible if more schemas and configurations are added later on. I considered saving and loading the schema in a temporary location, but doubtful that the KeyPath values will be available as they are not Codable. I suspect schemaMetadata() has the information I need to map the backing data without a schema for snapshots, but as mentioned previously, properties are inaccessible… Allow access to entity metatypes, like value types from SchemaProperty. They’re useful for getting data out of snapshots and casting them to CodingKeys and PredicateCodableKeyPathProviding. They do not carry over when you provide them in the Schema. I am unable to retrieve the primary key from PersistentIdentifier. It seems like once you create one, you can’t get it out, like the DataStoreConfiguration in ModelContainer is not the one you used to set it up. I cannot cast it, it is an entirely different struct? I have to use JSONSerialization to extract it, but I want to get it directly since it is not a column in my database. It is transformed when it goes to/from my tables. It’s unknown how to support some schema options, such as Spotlight and CloudKit. Allow for extending macro options, such as adding options to set as primary key, whether to auto increment, etc… You can create a schema for super and sub entities, but it doesn’t appear you can actually set them up from the @Model macro or use inheritance on these models… SwiftData history tracking seems incomplete for HistoryDelete, because that protocol requires HistoryTombstone, but this type cannot be instantiated, nor does it contain anything useful to infer from. As an aside, I want to create my own custom ModelActor that is a global actor. However, I’m unable to replicate the executor that Apple provides where the executor has a ModelContext, because this type does not conform to Sendable. So how did Apple do this? The documentation doesn’t mention unchecked Sendable, but I figure if the protocol is available then we would be able to set up our own. And please add concurrency features! Anyway, I hope for more continued support in the future and I am looking forward to what’s new this WWDC! 😊
0
0
93
May ’25