Search results for

“SwiftData inheritance relationship”

4,981 results found

Post

Replies

Boosts

Views

Activity

Reply to Allow "Browser" to find devices on local networks
I’d like to clarify your overall goal here. Are you planning to ship an app based on Chromium? Or are you building some sort of plug-in that you install within Chromium? This matters because… [quote='800879021, poluyanov, /thread/800879, /profile/poluyanov'] simply overwriting files in the app bundle [/quote] Right. That breaks the seal on the code signature, which causes problems for all privacy subsystems, which rely on the code signature to track the identity of your code, that is, to determine that version N+1 of your app is the ‘same code’ as version N. This is something we call out in TN3179 Understanding local network privacy: To ensure that local network privacy reliably tracks the identity of your macOS program, sign it with an Apple-issued code-signing identity. Most apps don’t suffer from this problem because, when Xcode rebuilds the app, it signs result. If you’ve selected an Apple-issued code-signing identity, the new app has the same designated requirement as the previous app, and thus the OS tr
Sep ’25
New IOS APP Help
Hello, I am looking to develop a relationship with a developer that has experience running through the IOS build approval process. To elaborate, my team and I have designed and built a software application which is working through the Apple Developer review process to have the app approved and released to the App Store. Unfortunately, there has been some challenges, simple challenges in my eyes with our interface preventing Apple from approving our application. Happy to elaborate further. A primary problem and solution I have seen is the software build was testing solely on the iPhone but as recently directed it seem the application must be accessible on iPad as well. With this the case, I have experience some software platforms where on the ipad the interface is not displayed on the whole screen. I am looking for direction on how to implement this setup for the 1st IOS build. Another concern from Apples Developer Review team is the App Tracking Transparency kit may need to be implemented.
0
0
865
Sep ’25
CloudKit Sync with TestFlight
I'm working on a new app with SwiftData and now adding CloudKit Sync. Everything is working fine in the simulator against the development CloudKit Schema. I successfully deployed the schema to production. However, the TestFlight builds fail against production. This is what I see in the logs, but I haven't been able to find info on how to fix it. Help appreciated. CoreData+CloudKit: -[NSCloudKitMirroringDelegate _requestAbortedNotInitialized:](2205): - Never successfully initialized and cannot execute request '' due to error: Error Domain=CKErrorDomain Code=2 CKInternalErrorDomain: 1011 UserInfo={ContainerID=, NSDebugDescription=CKInternalErrorDomain: 1011, CKPartialErrors=, RequestUUID=, NSLocalizedDescription=, CKErrorDescription=, NSUnderlyingError=0x1078e9fe0 {Error Domain=CKInternalErrorDomain Code=1011 UserInfo={CKErrorDescription=, NSLocalizedDescription=, CKPartialErrors=}}} CoreData+CloudKit: -[NSCloudKitMirroringDelegate _performSetupRequest:]_block_invoke(1153): : Successfully set up Cloud
1
0
132
Sep ’25
Nested NavigationSplitView has unexpected layout shift inside a TabView
I have initialized a new SwiftUI project for iOS. I wrapped the default NavigationSplitView from SwiftData inside a TabView and ran into the following issue: On an iPad (Air, 13 inch, iPadOs 26), the button to open/close the sidebar shifts downwards while opening or closing the sidebar. When the animation finishes, the button jumps back to the original position. Here's the code I used inside my ContentView: var body: some View { TabView { Tab(Kategorien, systemImage: circle.fill) { NavigationSplitView { List { ForEach(items) { item in NavigationLink { Text(Item at (item.timestamp, format: Date.FormatStyle(date: .numeric, time: .standard))) } label: { Text(item.timestamp, format: Date.FormatStyle(date: .numeric, time: .standard)) } } .onDelete(perform: deleteItems) } .toolbar { ToolbarItem(placement: .navigationBarTrailing) { EditButton() } ToolbarItem { Button(action: addItem) { Label(Add Item, systemImage: plus) } } } } detail: { Text(Select an item) } } Tab(Alle Bücher, systemImage: circle.fill) {
Topic: UI Frameworks SubTopic: SwiftUI
0
0
71
Sep ’25
SwiftData ModelCoders.swift:1069 Unable to decode
Hello Developer Support, I have the following code and the following crash. How can the swift data model unable to decode and yet able to display the decoded value at the same time?! What's missing here? CODE: @Model final class DisplayCache { init(point: MKMapPoint) { self.point = point } var point: MKMapPoint } CRASH SwiftData/ModelCoders.swift:1069: Fatal error: Unable to decode this value MKMapPoint(x: 74358466.66307731, y: 97927933.41833577)
3
0
172
Sep ’25
Mutating an array of model objects that is a child of a model object
Hi all, In my SwiftUI / SwiftData / Cloudkit app which is a series of lists, I have a model object called Project which contains an array of model objects called subprojects: final class Project1 { var name: String = @Relationship(deleteRule: .cascade, inverse: Subproject.project) var subprojects : [Subproject]? init(name: String) { self.name = name self.subprojects = [] } } The user will select a project from a list, which will generate a list of subprojects in another list, and if they select a subproject, it will generate a list categories and if the user selects a category it will generate another list of child objects owned by category and on and on. This is the pattern in my app, I'm constantly passing arrays of model objects that are the children of other model objects throughout the program, and I need the user to be able to add and remove things from them. My initial approach was to pass these arrays as bindings so that I'd be able to mutate them. This worked for the most part but
5
0
237
Sep ’25
Error accessing backing data on deleted item in detached task
I have been working on an app for the past few months, and one issue that I have encountered a few times is an error where quick subsequent deletions cause issues with detached tasks that are triggered from some user actions. Inside a Task.detached, I am building an isolated model context, querying for LineItems, then iterating over those items. The crash happens when accessing a Transaction property through a relationship. var byTransactionId: [UUID: [LineItem]] { return Dictionary(grouping: self) { item in item.transaction?.id ?? UUID() } } In this case, the transaction has been deleted, but the relationship existed when the fetch occurred, so the transaction value is non-nil. The crash occurs when accessing the id. This is the error. SwiftData/BackingData.swift:1035: Fatal error: This model instance was invalidated because its backing data could no longer be found the store. PersistentIdentifier(id: SwiftData.PersistentIdentifier.ID(backing: SwiftData.PersistentIdentifier.Persist
3
0
384
Sep ’25
Reply to Save SwiftData object for model with one to many relationship
import SwiftData //Model for Earned Value Analysis The Model @Model final class CostReport{ var aCWP: Double //Actual Cost of Work Performed var bCWP: Double //Budgeted Cost of Work Performed var bCWS: Double // Budgeted Cost of Work Scheduled var cumACWP: Double// Cumlative Actual Cost of Work Performed var cumBCWP: Double // Cumlative Budgeted Cost of Work Performed var cumBCWS: Double // Cumlative Budgeted Cost of Work Scheduled var startDateOfPeriod: Date var endDateOfPeriod: Date var contract: Contract? init(aCWP: Double = 0.0, bCWP: Double = 0.0, bCWS: Double = 0.0, cumACWP: Double = 0.0, cumBCWP: Double = 0.0, cumBCWS: Double = 0.0, startDateOfPeriod: Date = .now, endDateOfPeriod: Date = .now, contract: Contract) { self.aCWP = aCWP self.bCWP = bCWP self.bCWS = bCWS self.cumACWP = cumACWP self.cumBCWP = cumBCWP self.cumBCWS = cumBCWS self.startDateOfPeriod = startDateOfPeriod self.endDateOfPeriod = endDateOfPeriod self.contract = contract } } @Model //Model for Contracts final class Contract{ v
Sep ’25
Save SwiftData object for model with one to many relationship
First the Model: import Foundation import SwiftData //Model for Earned Value Analysis @Model final class CostReport{ var aCWP: Double //Actual Cost of Work Performed var bCWP: Double //Budgeted Cost of Work Performed var bCWS: Double // Budgeted Cost of Work Scheduled var cumACWP: Double// Cumlative Actual Cost of Work Performed var cumBCWP: Double // Cumlative Budgeted Cost of Work Performed var cumBCWS: Double // Cumlative Budgeted Cost of Work Scheduled var startDateOfPeriod: Date var endDateOfPeriod: Date var contract: Contract? init(aCWP: Double = 0.0, bCWP: Double = 0.0, bCWS: Double = 0.0, cumACWP: Double = 0.0, cumBCWP: Double = 0.0, cumBCWS: Double = 0.0, startDateOfPeriod: Date = .now, endDateOfPeriod: Date = .now, contract: Contract) { self.aCWP = aCWP self.bCWP = bCWP self.bCWS = bCWS self.cumACWP = cumACWP self.cumBCWP = cumBCWP self.cumBCWS = cumBCWS self.startDateOfPeriod = startDateOfPeriod self.endDateOfPeriod = endDateOfPeriod self.contract = contract } } @Model //Model for Contract
4
0
246
Sep ’25
Is their a way to show creators on our app their earnings?
Our app is a creator-based content app where they can upload content and charge through an in-app purchase subscription. Although as the app grows and creators come on board that we have a more distant relationship with they want to be able to view their earnings, number of subscribers, etc., on some type of dashboard. We are using native in-app purchase functionality, and even with Advanced Commerce being announced, I can't seem to find this functionality to offer a creator-facing subscriptions analytics dashboard without giving them direct access to App Store Connect. Which obviously doesn't scale as the number of creators grows. Is there a 3rd party api? Or an internal function I'm missing?
0
0
195
Sep ’25
Reply to SMAppService Sample Code seems broken
I have noticed that launchd is changing my status to 78 at times which I vaguely remember is a permissions issue but I can't find the relevant documentation anymore. I'm not actually attempting to do anything even remotely privileged in the code yet; the example service is unchanged save for a liberal blanketing of print() calls to try and see if anything is ever running. Nothing ever shows up on the console so I have no clue what would lack permission to run if I'm getting SMAppService.Status.enabled back from the service object. Does the nested launchd job not inherit the parent app's entitlements or something?
Sep ’25
Inheritance in SwiftData — Fatal error: Never access a full future backing data
I'm implementing SwiftData with inheritance in an app. I have an Entity class with a property name. This class is inherited by two other classes: Store and Person. The Entity model has a one-to-many relationship with a Transaction class. I can list all my Entity models in a List with a @Query annotation without a problem. However, then I try to access the name property of an Entity from a Transaction relationship, the app crashes with the following error: Thread 1: Fatal error: Never access a full future backing data - PersistentIdentifier(id: SwiftData.PersistentIdentifier.ID(backing: SwiftData.PersistentIdentifier.PersistentIdentifierBacking.managedObjectID(0x96530ce28d41eb63 ))) with Optional(F07E7E23-F8F0-4CC0-B282-270B5EDDC7F3) From my attempts to fix the issue, I noticed that: The crash seems related to the relationships with classes that has inherit from another class, since it only happens there. When I create new data, I can usually acces
1
0
272
Sep ’25
Reply to Allow "Browser" to find devices on local networks
I’d like to clarify your overall goal here. Are you planning to ship an app based on Chromium? Or are you building some sort of plug-in that you install within Chromium? This matters because… [quote='800879021, poluyanov, /thread/800879, /profile/poluyanov'] simply overwriting files in the app bundle [/quote] Right. That breaks the seal on the code signature, which causes problems for all privacy subsystems, which rely on the code signature to track the identity of your code, that is, to determine that version N+1 of your app is the ‘same code’ as version N. This is something we call out in TN3179 Understanding local network privacy: To ensure that local network privacy reliably tracks the identity of your macOS program, sign it with an Apple-issued code-signing identity. Most apps don’t suffer from this problem because, when Xcode rebuilds the app, it signs result. If you’ve selected an Apple-issued code-signing identity, the new app has the same designated requirement as the previous app, and thus the OS tr
Replies
Boosts
Views
Activity
Sep ’25
Reply to Mutating an array of model objects that is a child of a model object
@joadan but for self.project.subcategories?.removeAll { $0 == subcategory} you won't know if it didn't removeAll because subcategory didn't exist in the array, or if subcategories was nil to begin with because it didn't load from CloudKit / SwiftData.
Replies
Boosts
Views
Activity
Sep ’25
New IOS APP Help
Hello, I am looking to develop a relationship with a developer that has experience running through the IOS build approval process. To elaborate, my team and I have designed and built a software application which is working through the Apple Developer review process to have the app approved and released to the App Store. Unfortunately, there has been some challenges, simple challenges in my eyes with our interface preventing Apple from approving our application. Happy to elaborate further. A primary problem and solution I have seen is the software build was testing solely on the iPhone but as recently directed it seem the application must be accessible on iPad as well. With this the case, I have experience some software platforms where on the ipad the interface is not displayed on the whole screen. I am looking for direction on how to implement this setup for the 1st IOS build. Another concern from Apples Developer Review team is the App Tracking Transparency kit may need to be implemented.
Replies
0
Boosts
0
Views
865
Activity
Sep ’25
Reply to Inheritance in SwiftData — Fatal error: Never access a full future backing data
This looks like a known issue related to SwiftData failing to materialize a relationship that has a super class. I’d suggest that you file a feedback report so you can use it to request the latest status of the issue. Best, —— Ziqiao Chen  Worldwide Developer Relations.
Replies
Boosts
Views
Activity
Sep ’25
CloudKit Sync with TestFlight
I'm working on a new app with SwiftData and now adding CloudKit Sync. Everything is working fine in the simulator against the development CloudKit Schema. I successfully deployed the schema to production. However, the TestFlight builds fail against production. This is what I see in the logs, but I haven't been able to find info on how to fix it. Help appreciated. CoreData+CloudKit: -[NSCloudKitMirroringDelegate _requestAbortedNotInitialized:](2205): - Never successfully initialized and cannot execute request '' due to error: Error Domain=CKErrorDomain Code=2 CKInternalErrorDomain: 1011 UserInfo={ContainerID=, NSDebugDescription=CKInternalErrorDomain: 1011, CKPartialErrors=, RequestUUID=, NSLocalizedDescription=, CKErrorDescription=, NSUnderlyingError=0x1078e9fe0 {Error Domain=CKInternalErrorDomain Code=1011 UserInfo={CKErrorDescription=, NSLocalizedDescription=, CKPartialErrors=}}} CoreData+CloudKit: -[NSCloudKitMirroringDelegate _performSetupRequest:]_block_invoke(1153): : Successfully set up Cloud
Replies
1
Boosts
0
Views
132
Activity
Sep ’25
Nested NavigationSplitView has unexpected layout shift inside a TabView
I have initialized a new SwiftUI project for iOS. I wrapped the default NavigationSplitView from SwiftData inside a TabView and ran into the following issue: On an iPad (Air, 13 inch, iPadOs 26), the button to open/close the sidebar shifts downwards while opening or closing the sidebar. When the animation finishes, the button jumps back to the original position. Here's the code I used inside my ContentView: var body: some View { TabView { Tab(Kategorien, systemImage: circle.fill) { NavigationSplitView { List { ForEach(items) { item in NavigationLink { Text(Item at (item.timestamp, format: Date.FormatStyle(date: .numeric, time: .standard))) } label: { Text(item.timestamp, format: Date.FormatStyle(date: .numeric, time: .standard)) } } .onDelete(perform: deleteItems) } .toolbar { ToolbarItem(placement: .navigationBarTrailing) { EditButton() } ToolbarItem { Button(action: addItem) { Label(Add Item, systemImage: plus) } } } } detail: { Text(Select an item) } } Tab(Alle Bücher, systemImage: circle.fill) {
Topic: UI Frameworks SubTopic: SwiftUI
Replies
0
Boosts
0
Views
71
Activity
Sep ’25
SwiftData ModelCoders.swift:1069 Unable to decode
Hello Developer Support, I have the following code and the following crash. How can the swift data model unable to decode and yet able to display the decoded value at the same time?! What's missing here? CODE: @Model final class DisplayCache { init(point: MKMapPoint) { self.point = point } var point: MKMapPoint } CRASH SwiftData/ModelCoders.swift:1069: Fatal error: Unable to decode this value MKMapPoint(x: 74358466.66307731, y: 97927933.41833577)
Replies
3
Boosts
0
Views
172
Activity
Sep ’25
Mutating an array of model objects that is a child of a model object
Hi all, In my SwiftUI / SwiftData / Cloudkit app which is a series of lists, I have a model object called Project which contains an array of model objects called subprojects: final class Project1 { var name: String = @Relationship(deleteRule: .cascade, inverse: Subproject.project) var subprojects : [Subproject]? init(name: String) { self.name = name self.subprojects = [] } } The user will select a project from a list, which will generate a list of subprojects in another list, and if they select a subproject, it will generate a list categories and if the user selects a category it will generate another list of child objects owned by category and on and on. This is the pattern in my app, I'm constantly passing arrays of model objects that are the children of other model objects throughout the program, and I need the user to be able to add and remove things from them. My initial approach was to pass these arrays as bindings so that I'd be able to mutate them. This worked for the most part but
Replies
5
Boosts
0
Views
237
Activity
Sep ’25
Error accessing backing data on deleted item in detached task
I have been working on an app for the past few months, and one issue that I have encountered a few times is an error where quick subsequent deletions cause issues with detached tasks that are triggered from some user actions. Inside a Task.detached, I am building an isolated model context, querying for LineItems, then iterating over those items. The crash happens when accessing a Transaction property through a relationship. var byTransactionId: [UUID: [LineItem]] { return Dictionary(grouping: self) { item in item.transaction?.id ?? UUID() } } In this case, the transaction has been deleted, but the relationship existed when the fetch occurred, so the transaction value is non-nil. The crash occurs when accessing the id. This is the error. SwiftData/BackingData.swift:1035: Fatal error: This model instance was invalidated because its backing data could no longer be found the store. PersistentIdentifier(id: SwiftData.PersistentIdentifier.ID(backing: SwiftData.PersistentIdentifier.Persist
Replies
3
Boosts
0
Views
384
Activity
Sep ’25
Reply to Save SwiftData object for model with one to many relationship
Found the issue: In a one to many relationship to be able to enter the one side of the relationship you need to identify the many side, even if you are not entering any values for the many side. In this case the many side is Contracts and a state variable needs to be declared @State private var contracts: [Contract] = [] with an empty array.
Replies
Boosts
Views
Activity
Sep ’25
Reply to Save SwiftData object for model with one to many relationship
import SwiftData //Model for Earned Value Analysis The Model @Model final class CostReport{ var aCWP: Double //Actual Cost of Work Performed var bCWP: Double //Budgeted Cost of Work Performed var bCWS: Double // Budgeted Cost of Work Scheduled var cumACWP: Double// Cumlative Actual Cost of Work Performed var cumBCWP: Double // Cumlative Budgeted Cost of Work Performed var cumBCWS: Double // Cumlative Budgeted Cost of Work Scheduled var startDateOfPeriod: Date var endDateOfPeriod: Date var contract: Contract? init(aCWP: Double = 0.0, bCWP: Double = 0.0, bCWS: Double = 0.0, cumACWP: Double = 0.0, cumBCWP: Double = 0.0, cumBCWS: Double = 0.0, startDateOfPeriod: Date = .now, endDateOfPeriod: Date = .now, contract: Contract) { self.aCWP = aCWP self.bCWP = bCWP self.bCWS = bCWS self.cumACWP = cumACWP self.cumBCWP = cumBCWP self.cumBCWS = cumBCWS self.startDateOfPeriod = startDateOfPeriod self.endDateOfPeriod = endDateOfPeriod self.contract = contract } } @Model //Model for Contracts final class Contract{ v
Replies
Boosts
Views
Activity
Sep ’25
Save SwiftData object for model with one to many relationship
First the Model: import Foundation import SwiftData //Model for Earned Value Analysis @Model final class CostReport{ var aCWP: Double //Actual Cost of Work Performed var bCWP: Double //Budgeted Cost of Work Performed var bCWS: Double // Budgeted Cost of Work Scheduled var cumACWP: Double// Cumlative Actual Cost of Work Performed var cumBCWP: Double // Cumlative Budgeted Cost of Work Performed var cumBCWS: Double // Cumlative Budgeted Cost of Work Scheduled var startDateOfPeriod: Date var endDateOfPeriod: Date var contract: Contract? init(aCWP: Double = 0.0, bCWP: Double = 0.0, bCWS: Double = 0.0, cumACWP: Double = 0.0, cumBCWP: Double = 0.0, cumBCWS: Double = 0.0, startDateOfPeriod: Date = .now, endDateOfPeriod: Date = .now, contract: Contract) { self.aCWP = aCWP self.bCWP = bCWP self.bCWS = bCWS self.cumACWP = cumACWP self.cumBCWP = cumBCWP self.cumBCWS = cumBCWS self.startDateOfPeriod = startDateOfPeriod self.endDateOfPeriod = endDateOfPeriod self.contract = contract } } @Model //Model for Contract
Replies
4
Boosts
0
Views
246
Activity
Sep ’25
Is their a way to show creators on our app their earnings?
Our app is a creator-based content app where they can upload content and charge through an in-app purchase subscription. Although as the app grows and creators come on board that we have a more distant relationship with they want to be able to view their earnings, number of subscribers, etc., on some type of dashboard. We are using native in-app purchase functionality, and even with Advanced Commerce being announced, I can't seem to find this functionality to offer a creator-facing subscriptions analytics dashboard without giving them direct access to App Store Connect. Which obviously doesn't scale as the number of creators grows. Is there a 3rd party api? Or an internal function I'm missing?
Replies
0
Boosts
0
Views
195
Activity
Sep ’25
Reply to SMAppService Sample Code seems broken
I have noticed that launchd is changing my status to 78 at times which I vaguely remember is a permissions issue but I can't find the relevant documentation anymore. I'm not actually attempting to do anything even remotely privileged in the code yet; the example service is unchanged save for a liberal blanketing of print() calls to try and see if anything is ever running. Nothing ever shows up on the console so I have no clue what would lack permission to run if I'm getting SMAppService.Status.enabled back from the service object. Does the nested launchd job not inherit the parent app's entitlements or something?
Replies
Boosts
Views
Activity
Sep ’25
Inheritance in SwiftData — Fatal error: Never access a full future backing data
I'm implementing SwiftData with inheritance in an app. I have an Entity class with a property name. This class is inherited by two other classes: Store and Person. The Entity model has a one-to-many relationship with a Transaction class. I can list all my Entity models in a List with a @Query annotation without a problem. However, then I try to access the name property of an Entity from a Transaction relationship, the app crashes with the following error: Thread 1: Fatal error: Never access a full future backing data - PersistentIdentifier(id: SwiftData.PersistentIdentifier.ID(backing: SwiftData.PersistentIdentifier.PersistentIdentifierBacking.managedObjectID(0x96530ce28d41eb63 ))) with Optional(F07E7E23-F8F0-4CC0-B282-270B5EDDC7F3) From my attempts to fix the issue, I noticed that: The crash seems related to the relationships with classes that has inherit from another class, since it only happens there. When I create new data, I can usually acces
Replies
1
Boosts
0
Views
272
Activity
Sep ’25