Search results for

“SwiftData inheritance relationship”

4,982 results found

Post

Replies

Boosts

Views

Activity

Reply to SwiftData crash on fetch
The logs after a failed migration could maybe be relevant: CoreData: annotation: Completed persistent history metadata tables update CoreData: annotation: Updating metadata CoreData: annotation: Finished updating metadata CoreData: annotation: Committing formal transaction CoreData: annotation: Finished committing formal transaction CoreData: annotation: Checkpointing WAL journal CoreData: annotation: Finished checkpointing WAL journal CoreData: annotation: Successfully completed lightweight migration on connection CoreData: annotation: Migration step 0.0 'Total migration time (on connection)' took 0.02 seconds CoreData: annotation: (migration) in-place migration completed successfully in 0.02 seconds Did migrate to stage 8 CoreData: annotation: (migration) Automatic schema migration succeeded for store at 'file:///var/mobile/Containers/Data/Application/74E75823-0F85-4194-A84D-B180739009BB/Library/Application%20Support/default.store' with migration stage: SwiftData/PersistentModel.swift:734: Fatal e
May ’25
Reply to Strange Live Activity Occurrence Behavior
I finally figured this out. It's really weird but I found the issue. In the initializer of the TimelineProvider struct of the UpNextWidget(), I created a SwiftData modelContainer. Once I remove that from the initializer to the function that will need the ModelContext, it works reliably as expected. Obviously this can not be intended behavior. I filed a feedback with a sample project based on the template for Live Activities that illustrates the problem. FB17655658
May ’25
App Stuck In Review For 8 Days, Repeated Board Escalations Severely Impacting Release Cycle
Dear App Review Team, I am writing to express deep concern over the repeated and prolonged delays the app is facing during the App Review process. Once again, a recent build—submitted on May 12—has been stuck in the In Review state for over a week. I have been informed that, as has become routine, the submission has been escalated to the App Review Board without any clear timeline or communication. This is not an isolated incident. Nearly every feature update submitted is referred to the board, resulting in unpredictable, weeks-long delays that severely disrupt the development and release cycle. These escalations consistently happen without clear reasoning, and without any proactive outreach or follow-up from the review team. The app is currently one of the highest-performing indie titles on the visionOS App Store, and I am committed to delivering the highest quality experience for users on Apple platforms. However, the current review process is making it increasingly difficult to operate responsibly or effic
1
0
134
May ’25
When I inherit from a class assigning SceneLocationView() sceneNode is nil
When I try to post a LocationAnnotations of a subclass respect to the one defining variable sceneLocationView, by way of: sceneLocationView.addLocationNodeWithConfirmedLocation(locationNode: bannerAnnotationLocation) When I enter in: public func addLocationNodeWithConfirmedLocation(locationNode: LocationNode) { if locationNode.location == nil || locationNode.locationConfirmed == false { return } updatePositionAndScaleOfLocationNode(locationNode: locationNode, initialSetup: true, animated: true) locationNodes.append(locationNode) print(sceneNode?.description ?? nil) self.sceneNode?.addChildNode(locationNode) } I find sceneNode to nil, like if the effect of the renderer is lost when subclassing. I also tried to create a new variable in the subclass also assigning SceneLocationView(), but sceneNode remains nil. What to do to force it to assume a value?
1
0
75
May ’25
DeviceCheck.generateToken, Error: com.apple.devicecheck.error 0
Dear Apple Developer Support Team, We are experiencing a recurring issue with the DeviceCheck API where the following error is being returned: com.apple.devicecheck.error 0 Upon analyzing our logs, we have noticed that this error occurs significantly more often when users are connected to Wi-Fi networks, compared to mobile networks. This leads us to suspect that there might be a relationship between Wi-Fi configuration and the DeviceCheck service’s ability to generate or validate tokens. We would like to know: Is this error code (0) known to be caused by specific types of network behavior or misconfigurations on Wi-Fi networks (e.g., DNS filtering, firewall restrictions, proxy servers)? Are there any recommended best practices for ensuring reliable DeviceCheck API communication over Wi-Fi networks? Additionally, could you please clarify what general conditions could trigger this com.apple.devicecheck.error 0? The lack of specific documentation makes debugging this issue difficult from our side. Any g
2
0
161
May ’25
Reply to #Predicate doesn't work with enum
I really hope this gets addressed in #WWDC25. Using a rawValue, you need to hardcode the rawValue, even the below wouldn't compile. #Predicate { $0.statusRawValue == Status.onTime.rawValue } Error: Key path cannot refer to enum case 'status' If the intent of SwiftData is to be modern and not expose the constraints of SQLite, then more needs to be done to improve support more swift types. Using a #Predicate seems like a blackbox, it works for simple primitive type comparisons but doesn't even work when trying to compare with something like Status.onTime.rawValue
May ’25
Shortcuts: Invalid action metadata
I have a habit tracker app that uses App Intents and Shortcuts. The app uses SwiftData to persist data, just in case that's important. One of the shortcuts serves to log habits. However, when the app has been in the background for a good while (over an hour or so), that particular shortcut always fails when I try to run it in the Shortcuts app with the system error Invalid action metadata caused by a bug in the host app. The app has a total of 9 shortcuts, and it's just this one particular shortcut that seems to be failing – the others continue to run without any issues even after the app has been in the background for a long time. The app intent/shortcut that is problematic is the one called HabitEntryAppIntent. For example purposes, I've also included one of the non-problematic intents in the code snippet below called HabitEntryCounterForTodayAppIntent. Both of these intents have one @Parameter value of type HabitEntity. I'll post code snippets in the replies because the character limit is not larg
2
0
183
May ’25
Reply to SwiftData crash on fetch
Apple DTS asked me for a link to the forums, so I'm adding what I know, and send them here. The crash is hard to reproduce, so this is what I know as of now: My app is a SwiftUI-app, with SwiftData I create the ModelContainer in the App-structure: var modelContainer: ModelContainer = { let modelContainer: ModelContainer let schema = Schema(versionedSchema: SchemaV7.self) let config = ModelConfiguration(cloudKitDatabase: .none) do { modelContainer = try ModelContainer( for: schema, migrationPlan: MigrationPlan.self, configurations: config ) } catch { Logger().error(Error creating model container: (error.localizedDescription)) preconditionFailure(Failed to create model container) } return modelContainer }() When I add a new Schema, the migration completes successfully, but for some users (not all), the app crashes. If I delete the app and install the same app but with no database, the app runs as normal. Migrations are done as custom migration steps, to provide logging options, but the crash happens st
May ’25
iOS AUv3 extension: no Icon shown in host
Hi, I'm working on an AUv3 project. The app itself displays my icon. However the Auv3 extension does not display any icon in any host app (AUM, Drambo, etc.0). I thought that the extension would inherit the host app icon but that it does not appear to be the case. I tried to add the icon as a 1024x1024 file to the extension target and the update my extension plist file withe a CFBundleIconFile key but no luck either. It must surely be really easy. What am I missing? Thanks in advance for your help!
5
0
154
May ’25
macOS SwiftData app never syncs with CloudKit
I'm using SwiftData with CloutKit with a very simple app. Data syncs between iOS, iPadOS, and visionOS, but not macOS. From what I can tell, macOS is never getting CK messages unless I'm running the app from Xcode. I can listen for the CK messages and show a line in a debug overlay. This works perfectly when I run from Xcode. I can see the notifications and see updates in my app. However, if I just launch the app outside of Xcode I will never see any changes or notifications. It is as if the Mac app never even tries to contact CloudKit. Schema has been deployed in the CloudKit console. The app is based on the multi-platform Xcode template. Again, only the macOS version has this issue. Is there some extra permission or setting I need to set up in order to use CloudKit on macOS? @State private var publisher = NotificationCenter.default.publisher(for: NSPersistentCloudKitContainer.eventChangedNotification).receive(on: DispatchQueue.main) .onReceive(publisher) { notification in // Listen for changes in C
1
0
206
May ’25
Export/Import data with SwiftData
Hi ! Would anyone know (if possible) how to create backup files to export and then import from the data recorded by SwiftData? For those who wish, here is a more detailed explanation of my case: I am developing a small management software with customers and events represented by distinct classes. I would like to have an Export button to create a file with all the instances of these 2 classes and another Import button to replace all the old data with the new ones from a previously exported file. I looked for several solutions but I'm a little lost...
0
0
155
May ’25
SwiftData 100% crash when fetching history with codable (test included!)
SwiftData crashes 100% when fetching history of a model that contains an optional codable property that's updated: SwiftData/Schema.swift:389: Fatal error: Failed to materialize a keypath for someCodableID.someID from CrashModel. It is possible that this path traverses a type that does not work with append(), please file a bug report with a test. Would really appreciate some help or even a workaround. Code: import Foundation import SwiftData import Testing struct VaultsSwiftDataKnownIssuesTests { @Test func testCodableCrashInHistoryFetch() async throws { let container = try ModelContainer( for: CrashModel.self, configurations: .init( isStoredInMemoryOnly: true ) ) let context = ModelContext(container) try SimpleHistoryChecker.hasLocalHistoryChanges(context: context) // 1: insert a new value and save let model = CrashModel() model.someCodableID = SomeCodableID(someID: testid1) context.insert(model) try context.save() // 2: check history it's fine. try SimpleHistoryChecker.hasLocalHis
0
0
98
May ’25
Reply to Using App Intents in Live Activity to Pause a Timer
The solution is found. To use buttons in LA or Dynamic Island, it shouldn’t be AppIntent, it should be LiveActivityIntent. struct PauseIntent: LiveActivityIntent { // followed by the rest of the code } either load the user defaults data that is linked with App Group or use SwiftData/CoreData, inject model container, and save the updated state there. Then update the live activity, the LA or Dynamic Island will show the updated ContentState. When returning to the app, reload the data from the data store and rebuild the necessary view models.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
May ’25
Reply to Fetching data with relationships directly faults the relationships even when not accessed
Here is a simple test project: https://github.com/GNiewoehner/swiftdata-test-app On start it creates some dummy data, and fetches them without accessing any relationships. The logs are printed to the console.
Replies
Boosts
Views
Activity
May ’25
Reply to SwiftData crash on fetch
The logs after a failed migration could maybe be relevant: CoreData: annotation: Completed persistent history metadata tables update CoreData: annotation: Updating metadata CoreData: annotation: Finished updating metadata CoreData: annotation: Committing formal transaction CoreData: annotation: Finished committing formal transaction CoreData: annotation: Checkpointing WAL journal CoreData: annotation: Finished checkpointing WAL journal CoreData: annotation: Successfully completed lightweight migration on connection CoreData: annotation: Migration step 0.0 'Total migration time (on connection)' took 0.02 seconds CoreData: annotation: (migration) in-place migration completed successfully in 0.02 seconds Did migrate to stage 8 CoreData: annotation: (migration) Automatic schema migration succeeded for store at 'file:///var/mobile/Containers/Data/Application/74E75823-0F85-4194-A84D-B180739009BB/Library/Application%20Support/default.store' with migration stage: SwiftData/PersistentModel.swift:734: Fatal e
Replies
Boosts
Views
Activity
May ’25
Reply to Strange Live Activity Occurrence Behavior
I finally figured this out. It's really weird but I found the issue. In the initializer of the TimelineProvider struct of the UpNextWidget(), I created a SwiftData modelContainer. Once I remove that from the initializer to the function that will need the ModelContext, it works reliably as expected. Obviously this can not be intended behavior. I filed a feedback with a sample project based on the template for Live Activities that illustrates the problem. FB17655658
Replies
Boosts
Views
Activity
May ’25
App Stuck In Review For 8 Days, Repeated Board Escalations Severely Impacting Release Cycle
Dear App Review Team, I am writing to express deep concern over the repeated and prolonged delays the app is facing during the App Review process. Once again, a recent build—submitted on May 12—has been stuck in the In Review state for over a week. I have been informed that, as has become routine, the submission has been escalated to the App Review Board without any clear timeline or communication. This is not an isolated incident. Nearly every feature update submitted is referred to the board, resulting in unpredictable, weeks-long delays that severely disrupt the development and release cycle. These escalations consistently happen without clear reasoning, and without any proactive outreach or follow-up from the review team. The app is currently one of the highest-performing indie titles on the visionOS App Store, and I am committed to delivering the highest quality experience for users on Apple platforms. However, the current review process is making it increasingly difficult to operate responsibly or effic
Replies
1
Boosts
0
Views
134
Activity
May ’25
When I inherit from a class assigning SceneLocationView() sceneNode is nil
When I try to post a LocationAnnotations of a subclass respect to the one defining variable sceneLocationView, by way of: sceneLocationView.addLocationNodeWithConfirmedLocation(locationNode: bannerAnnotationLocation) When I enter in: public func addLocationNodeWithConfirmedLocation(locationNode: LocationNode) { if locationNode.location == nil || locationNode.locationConfirmed == false { return } updatePositionAndScaleOfLocationNode(locationNode: locationNode, initialSetup: true, animated: true) locationNodes.append(locationNode) print(sceneNode?.description ?? nil) self.sceneNode?.addChildNode(locationNode) } I find sceneNode to nil, like if the effect of the renderer is lost when subclassing. I also tried to create a new variable in the subclass also assigning SceneLocationView(), but sceneNode remains nil. What to do to force it to assume a value?
Replies
1
Boosts
0
Views
75
Activity
May ’25
Reply to ModelContext.model(for:) returns deleted objects
I'm writing some tests to confirm the behavior of my app, you are actually unit testing SwiftData and not your app. As for the problem, I am not sure it's a bug and that they deliberately keep the object in the ModelContext for a short while to avoid problems for the app using it. The following test would pass though #expect(result.isDeleted)
Replies
Boosts
Views
Activity
May ’25
DeviceCheck.generateToken, Error: com.apple.devicecheck.error 0
Dear Apple Developer Support Team, We are experiencing a recurring issue with the DeviceCheck API where the following error is being returned: com.apple.devicecheck.error 0 Upon analyzing our logs, we have noticed that this error occurs significantly more often when users are connected to Wi-Fi networks, compared to mobile networks. This leads us to suspect that there might be a relationship between Wi-Fi configuration and the DeviceCheck service’s ability to generate or validate tokens. We would like to know: Is this error code (0) known to be caused by specific types of network behavior or misconfigurations on Wi-Fi networks (e.g., DNS filtering, firewall restrictions, proxy servers)? Are there any recommended best practices for ensuring reliable DeviceCheck API communication over Wi-Fi networks? Additionally, could you please clarify what general conditions could trigger this com.apple.devicecheck.error 0? The lack of specific documentation makes debugging this issue difficult from our side. Any g
Replies
2
Boosts
0
Views
161
Activity
May ’25
Reply to #Predicate doesn't work with enum
I really hope this gets addressed in #WWDC25. Using a rawValue, you need to hardcode the rawValue, even the below wouldn't compile. #Predicate { $0.statusRawValue == Status.onTime.rawValue } Error: Key path cannot refer to enum case 'status' If the intent of SwiftData is to be modern and not expose the constraints of SQLite, then more needs to be done to improve support more swift types. Using a #Predicate seems like a blackbox, it works for simple primitive type comparisons but doesn't even work when trying to compare with something like Status.onTime.rawValue
Replies
Boosts
Views
Activity
May ’25
Shortcuts: Invalid action metadata
I have a habit tracker app that uses App Intents and Shortcuts. The app uses SwiftData to persist data, just in case that's important. One of the shortcuts serves to log habits. However, when the app has been in the background for a good while (over an hour or so), that particular shortcut always fails when I try to run it in the Shortcuts app with the system error Invalid action metadata caused by a bug in the host app. The app has a total of 9 shortcuts, and it's just this one particular shortcut that seems to be failing – the others continue to run without any issues even after the app has been in the background for a long time. The app intent/shortcut that is problematic is the one called HabitEntryAppIntent. For example purposes, I've also included one of the non-problematic intents in the code snippet below called HabitEntryCounterForTodayAppIntent. Both of these intents have one @Parameter value of type HabitEntity. I'll post code snippets in the replies because the character limit is not larg
Replies
2
Boosts
0
Views
183
Activity
May ’25
Reply to SwiftData crash on fetch
Apple DTS asked me for a link to the forums, so I'm adding what I know, and send them here. The crash is hard to reproduce, so this is what I know as of now: My app is a SwiftUI-app, with SwiftData I create the ModelContainer in the App-structure: var modelContainer: ModelContainer = { let modelContainer: ModelContainer let schema = Schema(versionedSchema: SchemaV7.self) let config = ModelConfiguration(cloudKitDatabase: .none) do { modelContainer = try ModelContainer( for: schema, migrationPlan: MigrationPlan.self, configurations: config ) } catch { Logger().error(Error creating model container: (error.localizedDescription)) preconditionFailure(Failed to create model container) } return modelContainer }() When I add a new Schema, the migration completes successfully, but for some users (not all), the app crashes. If I delete the app and install the same app but with no database, the app runs as normal. Migrations are done as custom migration steps, to provide logging options, but the crash happens st
Replies
Boosts
Views
Activity
May ’25
iOS AUv3 extension: no Icon shown in host
Hi, I'm working on an AUv3 project. The app itself displays my icon. However the Auv3 extension does not display any icon in any host app (AUM, Drambo, etc.0). I thought that the extension would inherit the host app icon but that it does not appear to be the case. I tried to add the icon as a 1024x1024 file to the extension target and the update my extension plist file withe a CFBundleIconFile key but no luck either. It must surely be really easy. What am I missing? Thanks in advance for your help!
Replies
5
Boosts
0
Views
154
Activity
May ’25
macOS SwiftData app never syncs with CloudKit
I'm using SwiftData with CloutKit with a very simple app. Data syncs between iOS, iPadOS, and visionOS, but not macOS. From what I can tell, macOS is never getting CK messages unless I'm running the app from Xcode. I can listen for the CK messages and show a line in a debug overlay. This works perfectly when I run from Xcode. I can see the notifications and see updates in my app. However, if I just launch the app outside of Xcode I will never see any changes or notifications. It is as if the Mac app never even tries to contact CloudKit. Schema has been deployed in the CloudKit console. The app is based on the multi-platform Xcode template. Again, only the macOS version has this issue. Is there some extra permission or setting I need to set up in order to use CloudKit on macOS? @State private var publisher = NotificationCenter.default.publisher(for: NSPersistentCloudKitContainer.eventChangedNotification).receive(on: DispatchQueue.main) .onReceive(publisher) { notification in // Listen for changes in C
Replies
1
Boosts
0
Views
206
Activity
May ’25
Export/Import data with SwiftData
Hi ! Would anyone know (if possible) how to create backup files to export and then import from the data recorded by SwiftData? For those who wish, here is a more detailed explanation of my case: I am developing a small management software with customers and events represented by distinct classes. I would like to have an Export button to create a file with all the instances of these 2 classes and another Import button to replace all the old data with the new ones from a previously exported file. I looked for several solutions but I'm a little lost...
Replies
0
Boosts
0
Views
155
Activity
May ’25
SwiftData 100% crash when fetching history with codable (test included!)
SwiftData crashes 100% when fetching history of a model that contains an optional codable property that's updated: SwiftData/Schema.swift:389: Fatal error: Failed to materialize a keypath for someCodableID.someID from CrashModel. It is possible that this path traverses a type that does not work with append(), please file a bug report with a test. Would really appreciate some help or even a workaround. Code: import Foundation import SwiftData import Testing struct VaultsSwiftDataKnownIssuesTests { @Test func testCodableCrashInHistoryFetch() async throws { let container = try ModelContainer( for: CrashModel.self, configurations: .init( isStoredInMemoryOnly: true ) ) let context = ModelContext(container) try SimpleHistoryChecker.hasLocalHistoryChanges(context: context) // 1: insert a new value and save let model = CrashModel() model.someCodableID = SomeCodableID(someID: testid1) context.insert(model) try context.save() // 2: check history it's fine. try SimpleHistoryChecker.hasLocalHis
Replies
0
Boosts
0
Views
98
Activity
May ’25
Reply to Using App Intents in Live Activity to Pause a Timer
The solution is found. To use buttons in LA or Dynamic Island, it shouldn’t be AppIntent, it should be LiveActivityIntent. struct PauseIntent: LiveActivityIntent { // followed by the rest of the code } either load the user defaults data that is linked with App Group or use SwiftData/CoreData, inject model container, and save the updated state there. Then update the live activity, the LA or Dynamic Island will show the updated ContentState. When returning to the app, reload the data from the data store and rebuild the necessary view models.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
May ’25