Search results for

“SwiftData inheritance relationship”

4,980 results found

Post

Replies

Boosts

Views

Activity

Container Failing to Initialize After a Successful Migration & Initialization
I'm experiencing the following error with my SwiftData container when running a build: Code=134504 Cannot use staged migration with an unknown model version. Code Structure - Summary I am using a versionedSchema to store multiple models in SwiftData. I started experiencing this issue when adding two new models in the newest Schema version. Starting from the current public version, V4.4.6, there are two migrations. Migration Summary The first migration is to V4.4.7. This is a lightweight migration removing one attribute from one of the models. This was tested and worked successfully. The second migration is to V5.0.0. This is a custom migration adding two new models, and instantiating instances of the two new models based on data from instances of the existing models. In the initial testing of this version, no issues were observed. Issue and Steps to Reproduce Reproduction of issue: Starting from a fresh build of the publicly released V4.4.6, I run a new build that contains both Schema Versio
2
0
722
Nov ’25
SwiftData: This model instance was invalidated because its backing data could no longer be found the store
Hello 👋, I encounter the This model instance was invalidated because its backing data could no longer be found the store crash with SwiftData. Which from what I understood means I try to access a model after it has been removed from the store (makes sense). I made a quick sample to reproduce/better understand because there some case(s) I can't figure it out. Let's take a concrete example, we have Home model and a Home can have many Room(s). // Sample code @MainActor let foo = Foo() // A single reference let database = Database(modelContainer: sharedModelContainer) // A single reference @MainActor class Foo { // Properties to explicilty keep reference of model(s) for the purpose of the POC var _homes = [Home]() var _rooms = [Room]() func fetch() async { let homes = await database.fetch().map { sharedModelContainer.mainContext.model(for: $0) as! Home } print(ObjectIdentifier(homes[0]), homes[0].rooms?.map(.id)) // This will crash here or not. } // Same version of a delete function with subtle changes.
2
0
274
Nov ’25
Reply to Mac App Packaging
Inno Setup was a sweet app. I used to use that when I made Windows software. I don't know anything about Filemaker. A quick search says that runtimes were deprecated and removed years ago. Apparently Filemaker 18 was the last version to support them. There is some kind of iOS App SDK that may still be supported. It doesn't sound like this would be a quick and/or easy solution, but that seems to be all there is. After Hypercard, there was never the same kind of custom database app community (Clipper, Access, Paradox, etc.) as on PCs. I don't know what you mean by inherited icons. A DMG is just a disk image. Its use in installing software is problematic. Why use a zip files or pkg installer when you can use DMGs that make it 3 times more difficult? Look at the pkgutil tool. All you need is a folder with the app you want to install. Create a directory tree of all the locations where you want to install files. Then use pkgutil to create an installer for that. Forget everything I said about the Mac App St
Nov ’25
Reply to Mac App Packaging
Etresoft, thanks for the reply. I assure you, I'm not trying to make work for myself or others, merely attempting to package a Filemaker 18 Runtime app. A Windows bod, I had no trouble creating a signed exe using Inno Setup, but have been pulling teeth trying to do the equivalent for the Mac version. I began by reading the official Mac guides, but found them impenetrable, so turned to Copilot and Chatgpt. After many weeks of toing and froing, I have reached the stage where I can script create a DMG, but am currently having trouble with inherited icons. Are you saying that if I had merely uploaded my runtime to the Mac App Store, I might have avoided all of this?
Nov ’25
Reply to iOS26.1 crashing all my live SwiftData Apps 😡
Just a quick update: This fix helps avoid the crash but it does not solve the issue cause by iOS26.1, which automatically changes SwiftData Arrays or Sets attributes from .externalStorage to .transformable. This in consequence blocks the iCloud sync mirroring and results with the full disappearance Customer's data after updating. It is a serious bug that needs to be address by Apple ASAP.
Nov ’25
Reply to CK WebServices getting 500 Internal Error
A server-to-server key is for a server script to authenticate with CloudKit and make API calls to a public database with the inherited privileges of the creator of the key. To access a private database with CloudKit web service, consider using an API token, as described here. Best, —— Ziqiao Chen  Worldwide Developer Relations.
Nov ’25
Reply to SwiftData not loading under iOS 26.1
Hi Chen, I don't believe it has anything to do with Transformables, in my opinion that is some another warning for handling image formats or colors but the image gets through just fine. I've had that warning way long before. I honestly think Apple should hold on the iOS26.2 before they fix this. It's messing millions of SwiftData Apps already published (customers are already pissed). Look at this answer I posted a few hours ago, it might help: https://developer.apple.com/forums/thread/808020
Nov ’25
Reply to SwiftData not loading under iOS 26.1
SharedModelContainer.txt Folks who filed their feedback report may have gotten responses from the feedback system. For people who see the same issue but haven't yet filed any feedback report, I'd like to share our investigation here to hopefully help. To give you more context, SwiftData (with DefaultStore) uses Core Data as its underlying storage mechanism. At runtime, SwiftData converts the schema to an in-memory Core Data model (NSManagedObjectModel), and uses the model to load and persist the data store. Before system 26.1, when handling an attribute of an array type, SwiftData converts the array type to Binary Data. On system 26.1, it instead converts the type to Transformable. This change leads to a difference between the in-memory model and the model used in the persisted data store, triggering a migration error with the following message: Error Domain=NSCocoaErrorDomain Code=134140 Persistent store migration failed, missing mapping model.” To work around the issue, you might
Nov ’25
Reply to iOS26.1 crashing all my live SwiftData Apps 😡
Thanks for the post, can you tell me a little bit more about what is under your swift data? Any changes? I'm not an expert in SwiftData at all, hopefully as you post your model other people can help you find why, however when I see that error I will consider a staged migration and I think, you should also consider a staged migration to resolve this type incompatibility: https://developer.apple.com/documentation/coredata/staged-migrations?language=objc Albert Pascual
  Worldwide Developer Relations.
Nov ’25
CloudKit, SwiftData models and app crashing
Hi all... The app I'm building is not really a beginner level test app, it's intended to be published so I want everything to be done properly while I'm both learning and building the app. I'm new to swift ecosystem but well experienced with python and JS ecosystems. These two models are causing my app to crash @Model final class CustomerModel { var id: String = UUID().uuidString var name: String = var email: String = var phone: String = var address: String = var city: String = var postalCode: String = var country: String = @Relationship(deleteRule: .nullify) var orders: [OrderModel]? @Relationship(deleteRule: .nullify) var invoices: [InvoiceModel]? init() {} } @Model final class OrderModel { var id: String = UUID().uuidString var total: Double = 0 var status: String = processing var tracking_id: String = var order_date: Date = Date.now var updated: Date = Date.now var delivery_date: Date? var active: Bool = true var createdAt: Date = Date.now var items: [OrderItem]? @Relationship
1
0
152
Nov ’25
Reply to macOS 26: retain cycle detected when navigation link label contains a Swift Chart
I'm also experiencing this issue, but I'm not using Charts. It's when navigating back to my Home tab on macOS only. This works fine on iOS. import SwiftData import SwiftUI struct ContentView: View { @Environment(.modelContext) private var modelContext @Query private var publications: [Publication] @State private var publicationError: EncodedPublicationError? @State private var showErrorAlert = false @State private var selectedTab = 0 var body: some View { NavigationStack { TabView(selection: $selectedTab) { ScrollView { FeaturedView() RecentlyOpenedView() Spacer(minLength: 20) RecentlyUpdatedView() Spacer(minLength: 60) } .tag(0) .tabItem { Label(Home, systemImage: house.fill) } LibraryView() .tag(1) .tabItem { Label(Library, systemImage: books.vertical.fill) } QuestionView() .tag(2) .tabItem { Label(Answers, systemImage: text.bubble.fill) } SearchView() .tag(3) .tabItem { Label(Search, systemImage: magnifyingglass) } } .navigationTitle(navigationTitle) .tabViewStyle(.sidebarAdaptable) .refreshable {
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Nov ’25
UserSendCDB fails due to permissions
I created a custom class that inherits from IOUserSCSIPeripheralDeviceType00 in the DriverKit SCSIPeripheralsDriverKit framework. When I attempted to send a vendor-specific command to a USB storage device using the UserSendCDB function of this class instance, the function returned the error: kIOReturnNotPrivileged (iokit_common_err(0x2c1)) // privilege violation However, when using UserSendCDB in the same way to issue standard SCSI commands such as INQUIRY or Test Unit Ready, no error occurred and the returned sense data was valid. Why is UserSendCDB able to send standard SCSI commands successfully, but vendor-specific commands return kIOReturnNotPrivileged? Is there any required entitlement, DriverKit capability, or implementation detail needed to allow vendor-specific CDBs? Below are the entitlements of my DriverKit extension: com.apple.developer.driverkit.transport.usb idVendor [number of vendorid] com.apple.developer.driverkit com.apple.developer.driverkit.allow-any-userclient-access com.a
3
0
367
Nov ’25
DEXT (IOUserSCSIParallelInterfaceController): Direct I/O Succeeds, but Buffered I/O Fails with Data Corruption on Large File Copies
Hi all, We are migrating a SCSI HBA driver from KEXT to DriverKit (DEXT), with our DEXT inheriting from IOUserSCSIParallelInterfaceController. We've encountered a data corruption issue that is reliably reproducible under specific conditions and are hoping for some assistance from the community. Hardware and Driver Configuration: Controller: LSI 3108 DEXT Configuration: We are reporting our hardware limitations to the framework via the UserReportHBAConstraints function, with the following key settings: // UserReportHBAConstraints... addConstraint(kIOMaximumSegmentAddressableBitCountKey, 0x20); // 32-bit addConstraint(kIOMaximumSegmentCountWriteKey, 129); addConstraint(kIOMaximumByteCountWriteKey, 0x80000); // 512KB Observed Behavior: Direct I/O vs. Buffered I/O We've observed that the I/O behavior differs drastically depending on whether it goes through the system file cache: 1. Direct I/O (Bypassing System Cache) -> 100% Successful When we use fio with the direct=1 flag, our read/write and data ve
13
0
601
Nov ’25
Container Failing to Initialize After a Successful Migration & Initialization
I'm experiencing the following error with my SwiftData container when running a build: Code=134504 Cannot use staged migration with an unknown model version. Code Structure - Summary I am using a versionedSchema to store multiple models in SwiftData. I started experiencing this issue when adding two new models in the newest Schema version. Starting from the current public version, V4.4.6, there are two migrations. Migration Summary The first migration is to V4.4.7. This is a lightweight migration removing one attribute from one of the models. This was tested and worked successfully. The second migration is to V5.0.0. This is a custom migration adding two new models, and instantiating instances of the two new models based on data from instances of the existing models. In the initial testing of this version, no issues were observed. Issue and Steps to Reproduce Reproduction of issue: Starting from a fresh build of the publicly released V4.4.6, I run a new build that contains both Schema Versio
Replies
2
Boosts
0
Views
722
Activity
Nov ’25
SwiftData: This model instance was invalidated because its backing data could no longer be found the store
Hello 👋, I encounter the This model instance was invalidated because its backing data could no longer be found the store crash with SwiftData. Which from what I understood means I try to access a model after it has been removed from the store (makes sense). I made a quick sample to reproduce/better understand because there some case(s) I can't figure it out. Let's take a concrete example, we have Home model and a Home can have many Room(s). // Sample code @MainActor let foo = Foo() // A single reference let database = Database(modelContainer: sharedModelContainer) // A single reference @MainActor class Foo { // Properties to explicilty keep reference of model(s) for the purpose of the POC var _homes = [Home]() var _rooms = [Room]() func fetch() async { let homes = await database.fetch().map { sharedModelContainer.mainContext.model(for: $0) as! Home } print(ObjectIdentifier(homes[0]), homes[0].rooms?.map(.id)) // This will crash here or not. } // Same version of a delete function with subtle changes.
Replies
2
Boosts
0
Views
274
Activity
Nov ’25
Reply to Mac App Packaging
Inno Setup was a sweet app. I used to use that when I made Windows software. I don't know anything about Filemaker. A quick search says that runtimes were deprecated and removed years ago. Apparently Filemaker 18 was the last version to support them. There is some kind of iOS App SDK that may still be supported. It doesn't sound like this would be a quick and/or easy solution, but that seems to be all there is. After Hypercard, there was never the same kind of custom database app community (Clipper, Access, Paradox, etc.) as on PCs. I don't know what you mean by inherited icons. A DMG is just a disk image. Its use in installing software is problematic. Why use a zip files or pkg installer when you can use DMGs that make it 3 times more difficult? Look at the pkgutil tool. All you need is a folder with the app you want to install. Create a directory tree of all the locations where you want to install files. Then use pkgutil to create an installer for that. Forget everything I said about the Mac App St
Replies
Boosts
Views
Activity
Nov ’25
Reply to Mac App Packaging
Etresoft, thanks for the reply. I assure you, I'm not trying to make work for myself or others, merely attempting to package a Filemaker 18 Runtime app. A Windows bod, I had no trouble creating a signed exe using Inno Setup, but have been pulling teeth trying to do the equivalent for the Mac version. I began by reading the official Mac guides, but found them impenetrable, so turned to Copilot and Chatgpt. After many weeks of toing and froing, I have reached the stage where I can script create a DMG, but am currently having trouble with inherited icons. Are you saying that if I had merely uploaded my runtime to the Mac App Store, I might have avoided all of this?
Replies
Boosts
Views
Activity
Nov ’25
Reply to iOS26.1 crashing all my live SwiftData Apps 😡
Just a quick update: This fix helps avoid the crash but it does not solve the issue cause by iOS26.1, which automatically changes SwiftData Arrays or Sets attributes from .externalStorage to .transformable. This in consequence blocks the iCloud sync mirroring and results with the full disappearance Customer's data after updating. It is a serious bug that needs to be address by Apple ASAP.
Replies
Boosts
Views
Activity
Nov ’25
Reply to CK WebServices getting 500 Internal Error
A server-to-server key is for a server script to authenticate with CloudKit and make API calls to a public database with the inherited privileges of the creator of the key. To access a private database with CloudKit web service, consider using an API token, as described here. Best, —— Ziqiao Chen  Worldwide Developer Relations.
Replies
Boosts
Views
Activity
Nov ’25
Reply to SwiftData not loading under iOS 26.1
Hi Chen, I don't believe it has anything to do with Transformables, in my opinion that is some another warning for handling image formats or colors but the image gets through just fine. I've had that warning way long before. I honestly think Apple should hold on the iOS26.2 before they fix this. It's messing millions of SwiftData Apps already published (customers are already pissed). Look at this answer I posted a few hours ago, it might help: https://developer.apple.com/forums/thread/808020
Replies
Boosts
Views
Activity
Nov ’25
Reply to SwiftData not loading under iOS 26.1
SharedModelContainer.txt Folks who filed their feedback report may have gotten responses from the feedback system. For people who see the same issue but haven't yet filed any feedback report, I'd like to share our investigation here to hopefully help. To give you more context, SwiftData (with DefaultStore) uses Core Data as its underlying storage mechanism. At runtime, SwiftData converts the schema to an in-memory Core Data model (NSManagedObjectModel), and uses the model to load and persist the data store. Before system 26.1, when handling an attribute of an array type, SwiftData converts the array type to Binary Data. On system 26.1, it instead converts the type to Transformable. This change leads to a difference between the in-memory model and the model used in the persisted data store, triggering a migration error with the following message: Error Domain=NSCocoaErrorDomain Code=134140 Persistent store migration failed, missing mapping model.” To work around the issue, you might
Replies
Boosts
Views
Activity
Nov ’25
Reply to iOS26.1 crashing all my live SwiftData Apps 😡
Thanks for the post, can you tell me a little bit more about what is under your swift data? Any changes? I'm not an expert in SwiftData at all, hopefully as you post your model other people can help you find why, however when I see that error I will consider a staged migration and I think, you should also consider a staged migration to resolve this type incompatibility: https://developer.apple.com/documentation/coredata/staged-migrations?language=objc Albert Pascual
  Worldwide Developer Relations.
Replies
Boosts
Views
Activity
Nov ’25
iOS26.1 crashing all my live SwiftData Apps 😡
Apple WTF? What did you do to all my Apps? none of them work in iOS26.1 (all worked in 26.0). XCode simply says: CoreData: error: addPersistentStoreWithType:configuration:URL:options:error: returned error NSCocoaErrorDomain (134140) * SwiftData is supposed to do all these automatically 🤷🏻
Replies
4
Boosts
0
Views
302
Activity
Nov ’25
Reply to CloudKit, SwiftData models and app crashing
Issue resolved: using the @Relationship macro on both sides instead of one is the issue. After I removed one @Relationship macro from one side, app compiles neatly.
Replies
Boosts
Views
Activity
Nov ’25
CloudKit, SwiftData models and app crashing
Hi all... The app I'm building is not really a beginner level test app, it's intended to be published so I want everything to be done properly while I'm both learning and building the app. I'm new to swift ecosystem but well experienced with python and JS ecosystems. These two models are causing my app to crash @Model final class CustomerModel { var id: String = UUID().uuidString var name: String = var email: String = var phone: String = var address: String = var city: String = var postalCode: String = var country: String = @Relationship(deleteRule: .nullify) var orders: [OrderModel]? @Relationship(deleteRule: .nullify) var invoices: [InvoiceModel]? init() {} } @Model final class OrderModel { var id: String = UUID().uuidString var total: Double = 0 var status: String = processing var tracking_id: String = var order_date: Date = Date.now var updated: Date = Date.now var delivery_date: Date? var active: Bool = true var createdAt: Date = Date.now var items: [OrderItem]? @Relationship
Replies
1
Boosts
0
Views
152
Activity
Nov ’25
Reply to macOS 26: retain cycle detected when navigation link label contains a Swift Chart
I'm also experiencing this issue, but I'm not using Charts. It's when navigating back to my Home tab on macOS only. This works fine on iOS. import SwiftData import SwiftUI struct ContentView: View { @Environment(.modelContext) private var modelContext @Query private var publications: [Publication] @State private var publicationError: EncodedPublicationError? @State private var showErrorAlert = false @State private var selectedTab = 0 var body: some View { NavigationStack { TabView(selection: $selectedTab) { ScrollView { FeaturedView() RecentlyOpenedView() Spacer(minLength: 20) RecentlyUpdatedView() Spacer(minLength: 60) } .tag(0) .tabItem { Label(Home, systemImage: house.fill) } LibraryView() .tag(1) .tabItem { Label(Library, systemImage: books.vertical.fill) } QuestionView() .tag(2) .tabItem { Label(Answers, systemImage: text.bubble.fill) } SearchView() .tag(3) .tabItem { Label(Search, systemImage: magnifyingglass) } } .navigationTitle(navigationTitle) .tabViewStyle(.sidebarAdaptable) .refreshable {
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Nov ’25
UserSendCDB fails due to permissions
I created a custom class that inherits from IOUserSCSIPeripheralDeviceType00 in the DriverKit SCSIPeripheralsDriverKit framework. When I attempted to send a vendor-specific command to a USB storage device using the UserSendCDB function of this class instance, the function returned the error: kIOReturnNotPrivileged (iokit_common_err(0x2c1)) // privilege violation However, when using UserSendCDB in the same way to issue standard SCSI commands such as INQUIRY or Test Unit Ready, no error occurred and the returned sense data was valid. Why is UserSendCDB able to send standard SCSI commands successfully, but vendor-specific commands return kIOReturnNotPrivileged? Is there any required entitlement, DriverKit capability, or implementation detail needed to allow vendor-specific CDBs? Below are the entitlements of my DriverKit extension: com.apple.developer.driverkit.transport.usb idVendor [number of vendorid] com.apple.developer.driverkit com.apple.developer.driverkit.allow-any-userclient-access com.a
Replies
3
Boosts
0
Views
367
Activity
Nov ’25
DEXT (IOUserSCSIParallelInterfaceController): Direct I/O Succeeds, but Buffered I/O Fails with Data Corruption on Large File Copies
Hi all, We are migrating a SCSI HBA driver from KEXT to DriverKit (DEXT), with our DEXT inheriting from IOUserSCSIParallelInterfaceController. We've encountered a data corruption issue that is reliably reproducible under specific conditions and are hoping for some assistance from the community. Hardware and Driver Configuration: Controller: LSI 3108 DEXT Configuration: We are reporting our hardware limitations to the framework via the UserReportHBAConstraints function, with the following key settings: // UserReportHBAConstraints... addConstraint(kIOMaximumSegmentAddressableBitCountKey, 0x20); // 32-bit addConstraint(kIOMaximumSegmentCountWriteKey, 129); addConstraint(kIOMaximumByteCountWriteKey, 0x80000); // 512KB Observed Behavior: Direct I/O vs. Buffered I/O We've observed that the I/O behavior differs drastically depending on whether it goes through the system file cache: 1. Direct I/O (Bypassing System Cache) -> 100% Successful When we use fio with the direct=1 flag, our read/write and data ve
Replies
13
Boosts
0
Views
601
Activity
Nov ’25