Search results for

“SwiftData inheritance relationship”

4,980 results found

Post

Replies

Boosts

Views

Activity

Reply to How to sending capability requests.
I have a new question: I include Capabilities in the Provisioning Profile that might not be used, just in case. If I don't list all these Capabilities in the driver's Entitlements, will it cause the driver to behave abnormally? No, this doesn't affect anything. I then created a UserClient inheriting from the IOUserClient class to access it from the app, but IOServiceOpen fails with code 0xe00002d7 and cannot open. Huh. So, 0xe00002d7 is kIOReturnOffline, but I'm not sure how you'd get it from IOServiceOpen. It's returned in a few places in DriverKit and xnu, but none of them look like places you'd reach from IOServiceOpen. My best guess is that you're either trying to open the wrong object or your subclass is in an odd/unexpected state which is making it non-connectable. If you haven't already, make sure you check the system log as it's possible we logged additional info about what actually happened. Actually... real-time correction of myself: And in the driver's Info.plist, the following definitions
Nov ’25
Reply to How to sending capability requests.
I understand that it is not necessary to include this com.apple.developer.driverkit.allow-any-userclient-access in the driver's Entitlements. I have a new question: I include Capabilities in the Provisioning Profile that might not be used, just in case. If I don't list all these Capabilities in the driver's Entitlements, will it cause the driver to behave abnormally? To issue vendor-specific commands, I created a driver class inheriting from the IOUserSCSIPeripheralDeviceType00 class in the SCSIPeripheralDriverKit Framework. I then created a UserClient inheriting from the IOUserClient class to access it from the app, but IOServiceOpen fails with code 0xe00002d7 and cannot open. The driver's entitlements are as follows. com.apple.developer.driverkit.transport.usb com.apple.developer.driverkit.family.scsicontroller com.apple.developer.driverkit.communicates-with-drivers com.apple.developer.driverkit.allow-third-party-userclients com.apple.developer.driverkit And in the driver's Info.plist
Nov ’25
A crash occurs when fetching history when Model has preserveValueOnDeletion attribute and using inheritance
Hello, In our app, we’ve modeled our schema using inheritance introduced in iOS 26.0, and we’re implementing SwiftData History to re-fetch models only when necessary. @Model public class Transaction { @Attribute(.preserveValueOnDeletion) public var date: Date = Date() public var amount: Double = 0 public var memo: String? } @Model public final class Spending: Transaction { public var installmentIndex: Int = 1 public var installment: Int = 1 public var installmentID: UUID? } If data has been deleted from database, we need to check a date property to determine whether to re-fetch datas. To do this, we added the preserveValueOnDeletion attribute to date property so we could retrieve it from the History tombstone value. However, after adding this attribute, a crash occurs. There is a console log Could not cast value of type 'Swift.ReferenceWritableKeyPath' (0x106bf8328) to 'Swift.PartialKeyPath' (0x1094f21d8). and error log attached StrictMoneyChecking-2025-11-07-105108.txt I also tried this in
1
0
298
Nov ’25
My Mac (Designed for iPad) on M5 Powerbook won't run in Xcode26
prior to upgrading from an M1 to M5 I could run the Mac on iPad via Xcode After upgrading to a M5 I keep getting dyld[88241]: Library not loaded: @rpath/APP.debug.dylib Referenced from: <207ED9FB-3483-3063-B9BC-81EC3BCB34AF> /private/var/folders/54/cwf8kbhx48j71vk_z3zm0t_m0000gn/X/471D0939-4FD4-59C7-8DB5-641DB2A36911/d/Wrapper/App.app/App Reason: tried: '/Users/xxx/Library/Developer/Xcode/DerivedData/project-esgmvpqlktgtvldltqmcjtupefnh/Build/Products/Debug-iphoneos/App.debug.dylib' (no such file), '/usr/lib/system/introspection/App.debug.dylib' (no such file, not in dyld cache), ... bunch more path searching.. Runpath Search paths: $(inherited) @executable_path/Frameworks Runpath Search paths with inherited /usr/lib/swit @executable_path/Frameworks @loader_path/Frameworks @executable_path/Frameworks
0
0
73
Nov ’25
Extra unwanted space in main window
Hi there! I'm having this issue with my main windows. I'm having a big space on top of that without any logic explanation (at least for my poor knowledge). Using the code below I'm getting this Windows layout: Does anybody have any guidance on how to get out that extra space at the beginning? Thanks a lot! import SwiftUI import SwiftData #if os(macOS) import AppKit #endif // Helper to access and control NSWindow for size/position persistence #if os(macOS) struct WindowAccessor: NSViewRepresentable { let onWindow: (NSWindow) -> Void func makeNSView(context: Context) -> NSView { let view = NSView() DispatchQueue.main.async { if let window = view.window { onWindow(window) } } return view } func updateNSView(_ nsView: NSView, context: Context) { DispatchQueue.main.async { if let window = nsView.window { onWindow(window) } } } } #endif @main struct KaraoPartyApp: App { @StateObject private var songsModel = SongsModel() @Environment(.openWindow) private var openWindow var body: some Scene { Group { W
0
0
69
Nov ’25
Reply to SwiftData not loading under iOS 26.1
Oh, that will be a serious issue, and we need to reproducible case to investigate. Would you mind to file a feedback report with a project + the prepared SwiftData store file + the steps to reproduce the issue for us, and share your report ID here? Thanks! Best, —— Ziqiao Chen  Worldwide Developer Relations.
Nov ’25
Reply to Xcode 26.1 / OS 26.1 regression with schema and macros
Please allow me to make sure I understand correctly: Are you saying that Xcode 26.1 automatically changes your code by adding @Attribute(.transformable) for your SwiftData properties with array collection types? If that's the case, would you mind to file a feedback report with the code before and after the change for us, and share your report ID here? Thanks! Best, —— Ziqiao Chen  Worldwide Developer Relations.
Nov ’25
iOS Multiple BSSID Parsing/Inherit Behavior Issue – HS2.0 IE Handling Incorrect (Non‑Tx VAP should not inherit Tx VAP’s HS2.0 Indication)
I am experiencing issue - iphone16/17 can't connect to the non-txvap SSID when the corresponding txvap is passpoint SSID. It may always fail to connect. But when I set the non-passpoint SSID as txvap and passpoint SSID as non-txvap, then iPhone16/17 can connect to the two SSID successfully. iPhone will add “HS20=1” flag for the non-passpoint SSID, then iPhone will ALWAYS not connect that SSID successfully. Please see the log below I captured from the issue iPhone. -[WFNetworkListController _updateViewControllerScanResults]_block_invoke: removing associationCtx network from scan results See detail in FB20923870 Is there anybody else meet this issue?
1
0
47
Nov ’25
Reply to CloudKit - moving record objects between zones
If you are using SwiftData + CloudKit, which is based on NSPersistentCloudKitContainer, it doesn't support cross-share relationships, and so you can't have a collection in one zone and a relationship of the collection (a sub-collection, for example) in another. This is mentioned in here: NSPersistentCloudKitContainer doesn’t support cross-share relationships. That is, it doesn’t allow relating objects associated with different shares. When sharing an object, NSPersistentCloudKitContainer moves the entire object graph, which includes the object and all its relationships, to the share’s record zone. If you are using the CloudKit framework directly, the source and target objects of CKRecord.Reference must be in the same zone of the same database, and so you will need to maintain the relationship with your own logic. Best, —— Ziqiao Chen  Worldwide Developer Relations.
Topic: Community SubTopic: Apple Developers Tags:
Nov ’25
Reply to SwiftData not loading under iOS 26.1
That is a migration error, which happens when you change your SwiftData models in a way unsupported by lightweight migration. You can probably start with reviewing the changes you made on your SwiftData models, if any. For more information about how to evolve your SwiftData schema, see this WWDC session. Best, —— Ziqiao Chen  Worldwide Developer Relations.
Nov ’25
Is that possible to update ModelContainer?
Here is what I thought I want to give each user a unique container, when the user login or register, the user could isolate their data in specific container. I shared the container in a singleton actor, I found it's possible to update the container in that actor. But I think it won't affect the modelContext which is in the Environment. Does SwiftData allow me or recommend to do that?
4
0
226
Nov ’25
iOS 26.1 and SwiftData: Can't reuse store?
I have one target building and filling the SwiftData store and then copying the same store file to another target of the app to use the contents. That worked fine from iOS 17 to iOS 26.0.1 Under iOS 26.1 I am getting following error: CoreData: error: This store file was previously used on a build with Persistence-1522 but is now running on a build with Persistence-1518. file:///Users/xxx/Library/Developer/CoreSimulator/Devices/0FE92EA2-57FA-4A5E-ABD0-DAB4DABC3E02/data/Containers/Data/Application/B44D3256-9B09-4A60-94E2-C5F11A6519E7/Documents/default.store What does it mean and how to get back to working app under iOS 26.1?
1
0
264
Nov ’25
SwiftData not loading under iOS 26.1
Updated the phone to iOS 26.1 and now the app is not working anymore, even previously approved version published on App Store which works perfectly on iOS 26.0.1, and iOS 18+. I deleted the app from the phone and installed fresh from App Store, still the same. Logic is that on start app copies previously prepared SwiftData store file (using the same models) from app bundle to Documents directory and uses it. Currently app just hungs with loader spinner spinning as it can t connect to the store. Getting this error in console when running from Xcode on real device with iOS 26.1 installed: CoreData: error: CoreData: error: Store failed to load. (type: SQLite, url: file:///var/mobile/Containers/Data/Application/DA32188D-8887-48F7-B828-1F676C8FBEF8/Documents/default.store) with error = Error Domain=NSCocoaErrorDomain Code=134140 Persistent store migration failed, missing mapping model. UserInfo={sourceModel=() isEditable 0, entities { /// there goes some long models description addPersistentStoreWithType
8
0
727
Nov ’25
CloudKit - moving record objects between zones
My app has three main SwiftData models: Collection, SavedItem, and Extract. A Collection can contain subcollections (folders within folders) and SavedItems (files). Each SavedItem can have child Extracts. I'm preparing for the ability for users to be able to share Collections with each other. Currently, my architecture treats each Collection as the root of its own CloudKit zone (a root parent Collection and all of its items and subcollections live in 1 zone). This makes sharing and isolation straightforward, but it also means that moving a SavedItem or subcollection between Collections involves moving it across zones. I’m trying to figure out the best pattern for handling these cross-zone moves while keeping data integrity, relationships, and sharing intact. My understanding is that in CloudKit, and moving a record from Zone A to Zone B would require deleting it from Zone A and recreating it in Zone B - while somehow maintaining the link back to my local SwiftData store. Has anyone
3
0
387
Nov ’25
Reply to SwiftData and CloudKit Issues
SwiftData + CloudKit integration uses NSPersistentCloutKitContainer under the hood, and it is intentional that the framework deletes the local data when the user turns off iCloud for the app in Settings. The behavior is discussed in this post. Feel free to follow up here with further questions, if any. Best, —— Ziqiao Chen  Worldwide Developer Relations.
Nov ’25
Reply to How to sending capability requests.
I have a new question: I include Capabilities in the Provisioning Profile that might not be used, just in case. If I don't list all these Capabilities in the driver's Entitlements, will it cause the driver to behave abnormally? No, this doesn't affect anything. I then created a UserClient inheriting from the IOUserClient class to access it from the app, but IOServiceOpen fails with code 0xe00002d7 and cannot open. Huh. So, 0xe00002d7 is kIOReturnOffline, but I'm not sure how you'd get it from IOServiceOpen. It's returned in a few places in DriverKit and xnu, but none of them look like places you'd reach from IOServiceOpen. My best guess is that you're either trying to open the wrong object or your subclass is in an odd/unexpected state which is making it non-connectable. If you haven't already, make sure you check the system log as it's possible we logged additional info about what actually happened. Actually... real-time correction of myself: And in the driver's Info.plist, the following definitions
Replies
Boosts
Views
Activity
Nov ’25
Reply to How to sending capability requests.
I understand that it is not necessary to include this com.apple.developer.driverkit.allow-any-userclient-access in the driver's Entitlements. I have a new question: I include Capabilities in the Provisioning Profile that might not be used, just in case. If I don't list all these Capabilities in the driver's Entitlements, will it cause the driver to behave abnormally? To issue vendor-specific commands, I created a driver class inheriting from the IOUserSCSIPeripheralDeviceType00 class in the SCSIPeripheralDriverKit Framework. I then created a UserClient inheriting from the IOUserClient class to access it from the app, but IOServiceOpen fails with code 0xe00002d7 and cannot open. The driver's entitlements are as follows. com.apple.developer.driverkit.transport.usb com.apple.developer.driverkit.family.scsicontroller com.apple.developer.driverkit.communicates-with-drivers com.apple.developer.driverkit.allow-third-party-userclients com.apple.developer.driverkit And in the driver's Info.plist
Replies
Boosts
Views
Activity
Nov ’25
A crash occurs when fetching history when Model has preserveValueOnDeletion attribute and using inheritance
Hello, In our app, we’ve modeled our schema using inheritance introduced in iOS 26.0, and we’re implementing SwiftData History to re-fetch models only when necessary. @Model public class Transaction { @Attribute(.preserveValueOnDeletion) public var date: Date = Date() public var amount: Double = 0 public var memo: String? } @Model public final class Spending: Transaction { public var installmentIndex: Int = 1 public var installment: Int = 1 public var installmentID: UUID? } If data has been deleted from database, we need to check a date property to determine whether to re-fetch datas. To do this, we added the preserveValueOnDeletion attribute to date property so we could retrieve it from the History tombstone value. However, after adding this attribute, a crash occurs. There is a console log Could not cast value of type 'Swift.ReferenceWritableKeyPath' (0x106bf8328) to 'Swift.PartialKeyPath' (0x1094f21d8). and error log attached StrictMoneyChecking-2025-11-07-105108.txt I also tried this in
Replies
1
Boosts
0
Views
298
Activity
Nov ’25
My Mac (Designed for iPad) on M5 Powerbook won't run in Xcode26
prior to upgrading from an M1 to M5 I could run the Mac on iPad via Xcode After upgrading to a M5 I keep getting dyld[88241]: Library not loaded: @rpath/APP.debug.dylib Referenced from: <207ED9FB-3483-3063-B9BC-81EC3BCB34AF> /private/var/folders/54/cwf8kbhx48j71vk_z3zm0t_m0000gn/X/471D0939-4FD4-59C7-8DB5-641DB2A36911/d/Wrapper/App.app/App Reason: tried: '/Users/xxx/Library/Developer/Xcode/DerivedData/project-esgmvpqlktgtvldltqmcjtupefnh/Build/Products/Debug-iphoneos/App.debug.dylib' (no such file), '/usr/lib/system/introspection/App.debug.dylib' (no such file, not in dyld cache), ... bunch more path searching.. Runpath Search paths: $(inherited) @executable_path/Frameworks Runpath Search paths with inherited /usr/lib/swit @executable_path/Frameworks @loader_path/Frameworks @executable_path/Frameworks
Replies
0
Boosts
0
Views
73
Activity
Nov ’25
Extra unwanted space in main window
Hi there! I'm having this issue with my main windows. I'm having a big space on top of that without any logic explanation (at least for my poor knowledge). Using the code below I'm getting this Windows layout: Does anybody have any guidance on how to get out that extra space at the beginning? Thanks a lot! import SwiftUI import SwiftData #if os(macOS) import AppKit #endif // Helper to access and control NSWindow for size/position persistence #if os(macOS) struct WindowAccessor: NSViewRepresentable { let onWindow: (NSWindow) -> Void func makeNSView(context: Context) -> NSView { let view = NSView() DispatchQueue.main.async { if let window = view.window { onWindow(window) } } return view } func updateNSView(_ nsView: NSView, context: Context) { DispatchQueue.main.async { if let window = nsView.window { onWindow(window) } } } } #endif @main struct KaraoPartyApp: App { @StateObject private var songsModel = SongsModel() @Environment(.openWindow) private var openWindow var body: some Scene { Group { W
Replies
0
Boosts
0
Views
69
Activity
Nov ’25
Reply to SwiftData not loading under iOS 26.1
Oh, that will be a serious issue, and we need to reproducible case to investigate. Would you mind to file a feedback report with a project + the prepared SwiftData store file + the steps to reproduce the issue for us, and share your report ID here? Thanks! Best, —— Ziqiao Chen  Worldwide Developer Relations.
Replies
Boosts
Views
Activity
Nov ’25
Reply to Xcode 26.1 / OS 26.1 regression with schema and macros
Please allow me to make sure I understand correctly: Are you saying that Xcode 26.1 automatically changes your code by adding @Attribute(.transformable) for your SwiftData properties with array collection types? If that's the case, would you mind to file a feedback report with the code before and after the change for us, and share your report ID here? Thanks! Best, —— Ziqiao Chen  Worldwide Developer Relations.
Replies
Boosts
Views
Activity
Nov ’25
iOS Multiple BSSID Parsing/Inherit Behavior Issue – HS2.0 IE Handling Incorrect (Non‑Tx VAP should not inherit Tx VAP’s HS2.0 Indication)
I am experiencing issue - iphone16/17 can't connect to the non-txvap SSID when the corresponding txvap is passpoint SSID. It may always fail to connect. But when I set the non-passpoint SSID as txvap and passpoint SSID as non-txvap, then iPhone16/17 can connect to the two SSID successfully. iPhone will add “HS20=1” flag for the non-passpoint SSID, then iPhone will ALWAYS not connect that SSID successfully. Please see the log below I captured from the issue iPhone. -[WFNetworkListController _updateViewControllerScanResults]_block_invoke: removing associationCtx network from scan results See detail in FB20923870 Is there anybody else meet this issue?
Replies
1
Boosts
0
Views
47
Activity
Nov ’25
Reply to CloudKit - moving record objects between zones
If you are using SwiftData + CloudKit, which is based on NSPersistentCloudKitContainer, it doesn't support cross-share relationships, and so you can't have a collection in one zone and a relationship of the collection (a sub-collection, for example) in another. This is mentioned in here: NSPersistentCloudKitContainer doesn’t support cross-share relationships. That is, it doesn’t allow relating objects associated with different shares. When sharing an object, NSPersistentCloudKitContainer moves the entire object graph, which includes the object and all its relationships, to the share’s record zone. If you are using the CloudKit framework directly, the source and target objects of CKRecord.Reference must be in the same zone of the same database, and so you will need to maintain the relationship with your own logic. Best, —— Ziqiao Chen  Worldwide Developer Relations.
Topic: Community SubTopic: Apple Developers Tags:
Replies
Boosts
Views
Activity
Nov ’25
Reply to SwiftData not loading under iOS 26.1
That is a migration error, which happens when you change your SwiftData models in a way unsupported by lightweight migration. You can probably start with reviewing the changes you made on your SwiftData models, if any. For more information about how to evolve your SwiftData schema, see this WWDC session. Best, —— Ziqiao Chen  Worldwide Developer Relations.
Replies
Boosts
Views
Activity
Nov ’25
Is that possible to update ModelContainer?
Here is what I thought I want to give each user a unique container, when the user login or register, the user could isolate their data in specific container. I shared the container in a singleton actor, I found it's possible to update the container in that actor. But I think it won't affect the modelContext which is in the Environment. Does SwiftData allow me or recommend to do that?
Replies
4
Boosts
0
Views
226
Activity
Nov ’25
iOS 26.1 and SwiftData: Can't reuse store?
I have one target building and filling the SwiftData store and then copying the same store file to another target of the app to use the contents. That worked fine from iOS 17 to iOS 26.0.1 Under iOS 26.1 I am getting following error: CoreData: error: This store file was previously used on a build with Persistence-1522 but is now running on a build with Persistence-1518. file:///Users/xxx/Library/Developer/CoreSimulator/Devices/0FE92EA2-57FA-4A5E-ABD0-DAB4DABC3E02/data/Containers/Data/Application/B44D3256-9B09-4A60-94E2-C5F11A6519E7/Documents/default.store What does it mean and how to get back to working app under iOS 26.1?
Replies
1
Boosts
0
Views
264
Activity
Nov ’25
SwiftData not loading under iOS 26.1
Updated the phone to iOS 26.1 and now the app is not working anymore, even previously approved version published on App Store which works perfectly on iOS 26.0.1, and iOS 18+. I deleted the app from the phone and installed fresh from App Store, still the same. Logic is that on start app copies previously prepared SwiftData store file (using the same models) from app bundle to Documents directory and uses it. Currently app just hungs with loader spinner spinning as it can t connect to the store. Getting this error in console when running from Xcode on real device with iOS 26.1 installed: CoreData: error: CoreData: error: Store failed to load. (type: SQLite, url: file:///var/mobile/Containers/Data/Application/DA32188D-8887-48F7-B828-1F676C8FBEF8/Documents/default.store) with error = Error Domain=NSCocoaErrorDomain Code=134140 Persistent store migration failed, missing mapping model. UserInfo={sourceModel=() isEditable 0, entities { /// there goes some long models description addPersistentStoreWithType
Replies
8
Boosts
0
Views
727
Activity
Nov ’25
CloudKit - moving record objects between zones
My app has three main SwiftData models: Collection, SavedItem, and Extract. A Collection can contain subcollections (folders within folders) and SavedItems (files). Each SavedItem can have child Extracts. I'm preparing for the ability for users to be able to share Collections with each other. Currently, my architecture treats each Collection as the root of its own CloudKit zone (a root parent Collection and all of its items and subcollections live in 1 zone). This makes sharing and isolation straightforward, but it also means that moving a SavedItem or subcollection between Collections involves moving it across zones. I’m trying to figure out the best pattern for handling these cross-zone moves while keeping data integrity, relationships, and sharing intact. My understanding is that in CloudKit, and moving a record from Zone A to Zone B would require deleting it from Zone A and recreating it in Zone B - while somehow maintaining the link back to my local SwiftData store. Has anyone
Replies
3
Boosts
0
Views
387
Activity
Nov ’25
Reply to SwiftData and CloudKit Issues
SwiftData + CloudKit integration uses NSPersistentCloutKitContainer under the hood, and it is intentional that the framework deletes the local data when the user turns off iCloud for the app in Settings. The behavior is discussed in this post. Feel free to follow up here with further questions, if any. Best, —— Ziqiao Chen  Worldwide Developer Relations.
Replies
Boosts
Views
Activity
Nov ’25