Search results for

“SwiftData inheritance relationship”

4,982 results found

Post

Replies

Boosts

Views

Activity

Reply to Multiple Executables in a Single Bundle Fails to Launch Others After Codesign
Getting back to this! Thanks again or the detailed response. The ugly truth is we need exec_b to be run from exec_a and by thirdparty tools that might need to call up it's UI. Think of exec_a as a sort of launcher program that orchestrates exec_b instances it's called up but so too do other parts of our pipeline, potentially. [quote='831858022, DTS Engineer, /thread/778169?answerId=831858022#831858022'] Add com.apple.application-identifier and com.apple.developer.team-identifier to your App. [/quote] Where should this be put? In the entitlements.plist we use while signing App? If we're to test the .inherit entitlement to just get exec_a launching exec_b, you're describing something like: # codesign other binaries... (macdeployqt does much of this work) # Sign child exec codesign ... --entitlements=./entitle_child.plist .../exec_b # Then sign the App (including the com.apple.application... tags) codesign ... --entitlements=./entitle_app.plist .../App.app Apologies if I'm missing the mark here. App val
Topic: Code Signing SubTopic: General Tags:
Apr ’25
Xcode 16.3 / macOS 15.4: SwiftData ModelContainer 在关联 iCloud Container 后初始化时崩溃
问题描述: 环境: Xcode 版本: 16.3 *macOS 版本: 15.4 项目类型: SwiftUI App with SwiftData 问题摘要: 当在 Xcode 项目的 Signing & Capabilities 中为启用了 iCloud 能力的应用关联一个具体的 iCloud Container 时,即使代码中并未显式启用 CloudKit 同步(例如,未在 ModelConfiguration 中设置 cloudKitDatabase),SwiftData 的 ModelContainer 在应用启动初始化时也会立即失败并导致崩溃。如果仅启用 iCloud 能力但不选择任何 Container,应用可以正常启动。此问题在使用空的 Schema([]) 进行测试时依然稳定复现。 复现步骤 (使用最小复现项目 - MRE): 使用 Xcode 16.3 创建一个新的 SwiftUI App 项目 (例如,命名为 CloudKitCrashTest)。 在创建时不要勾选 Host in CloudKit,或者,如果勾选了,先确保后续步骤覆盖相关设置。Storage 选择 None 或 SwiftData 均可复现。 修改 CloudKitCrashTestApp.swift 文件,添加 SwiftData 导入和基本的 ModelContainer 初始化逻辑。关键代码如下: import SwiftUI import SwiftData @main struct CloudKitCrashTestApp: App { let sharedModelContainer: ModelContainer init() { // 使用空 Schema 进行诊断 let schema = Schema([]) // *不* 指定 cloudKitDatabase let modelConfiguration = ModelConfiguration(schema: schema, isStoredInMemoryOnly: false) do { sharedModelContainer = try ModelContainer(for: schema, configurations: [modelConfi
2
0
464
Apr ’25
Reply to CloudKit not storing or updating public data in real time.
interferon, thanks for responding. Doing another google search for answers I learned that SwiftData and CloudKit only do private databases. So, I need to wait for the next best SwiftData update in order to have a public database. I can wait. So SwiftData and Cloudkit are not using public databases at this time.
Topic: Design SubTopic: General Tags:
Apr ’25
Missing report instance segments
I'm following the flow to get my reports data: get the requests (ONGOING or ONE_TIME_SNAPSHOT) for my app (https://api.appstoreconnect.apple.com/v1/apps/{{appID}}/analyticsReportRequests?filter%5BaccessType%5D=ONGOING) get the report (App Sessions Standard, for example) (https://api.appstoreconnect.apple.com/v1/analyticsReportRequests/{{requestID}}/reports?filter%5Bname%5D={{report}}) get the daily instances of the ONGOING request (https://api.appstoreconnect.apple.com/v1/analyticsReports/{{reportID}}/instances?filter%5Bgranularity%5D=DAILY) get the segments for the selected instance (https://api.appstoreconnect.apple.com/v1/analyticsReportInstances/{{instanceID}}/segments) This flow used to work fine, but recently I noticed that the earliest instances (mostly of processing date 2025-02-24 until 2025-02-27 return an error when I'm trying to get the instance segments usint the URL https://api.appstoreconnect.apple.com/v1/analyticsReportInstances/{{instanceID}}/segments. The error is the following: title: The s
0
0
140
Apr ’25
Reply to Need help with code signing.
It’s hard to offer a definitive answer to this because my focus is primarily technical and your relationship with your vendors is very much a business relationship. However, there are two standard ways to approach this. Both of them start with adding your developer to your team. From there: You can set their privileges such that they can do all the work on your behalf. See Developer > Support > Articles > Program Roles for info on what’s what there. You can give them limited privileges and have them send you an Xcode archive (.xcarchive), whereupon you deal with the final distribution step by loading that into Xcode. Share and Enjoy — Quinn “The Eskimo!” @ Developer Technical Support @ Apple let myEmail = eskimo + 1 + @ + apple.com
Topic: Code Signing SubTopic: General
Apr ’25
App crashes due to a third-party library we use making a bad memory access.
Is there a way to prevent or handle our application's crash if a third-party library makes a bad memory access? Basically, I want to know if using a buggy library (that causes bad memory access) will automatically make our application inherit those crashes, leading to our app crashing as well. If there is a way to prevent the crash, what methods can be used to do so? Thread 13: EXC_BAD_ACCESS (code=1, address=0x3a7d300)
2
0
234
Apr ’25
Using relationships in SortDescriptor crashing on release
If use a SortDescriptor for a model and sort by some attribute from a relationship, in DEBUG mode it all works fine and sorts. However, in release mode, it is an instant crash. SortDescriptor(.name, order: .reverse) ---- works SortDescriptor(.assignedUser?.name, order: .reverse) ---- works in debug but crash in release. What is the issue here, is it that SwiftData just incompetent to do this?
2
0
125
Mar ’25
Reply to Using any SwiftData Query causes app to hang
Thank you for the answer. I'll keep the printing function in mind. As for my original issue, I later found that it was likely due to 2 embedded NavigationStack. Removing the duplicated inner stack resolved the issue. I was able to continue, but got another hang with basically the same query. I am at the point where the time I've saved with the more concise syntax of SwiftData has been completely lost to debugging issues. I will revert back to CoreData. Even if it is more code, I feel like I have better control of the behaviour and life cycle.
Mar ’25
SwiftData Lightweight Migraton failed with VersionedSchema
Setup I am running a versionedSchema for my SwiftData model and attempting a migration. The new version contains a new attribute, with a type of a new custom enum defined in the @Model class, a default value, and a private(set). Migration was completed with a migrationPlan with nil values for willMigrate and didMigrate. Example - Previous Version @Model class MyNumber { var num: Int init() { // Init Code } } Example - Newest Version @Model class MyNumber { var num: Int private(set) var rounding: RoundAmount = MyNumber.RoundAmount.thirtyMinute init() { // Init Code } enum RoundAmount { case fiveMinute, tenMinute, thirtyMinute } } Issue Running this code, I get a swiftData error for “SwiftData/ModelCoders.swift:1585: nil value passed for a non-optional keyPath, /MyNumber.rounding” I assume this means a failure of the swiftData lightweight migration? I have reverted the version, removed private(set) and re-tried the migration with no success. Using the versionedSchema with mig
1
0
130
Mar ’25
SwiftData Many-To-Many Relationship: Failed to fulfill link PendingRelationshipLink
Hi there, I got two models here: Two Models, with Many-To-Many Relationship @Model final class PresetParams: Identifiable { @Attribute(.unique) var id: UUID = UUID() var positionX: Float = 0.0 var positionY: Float = 0.0 var positionZ: Float = 0.0 var volume: Float = 1.0 @Relationship(deleteRule: .nullify, inverse: Preset.presetAudioParams) var preset = [Preset]() init(position: SIMD3, volume: Float) { self.positionX = position.x self.positionY = position.y self.positionZ = position.z self.volume = volume self.preset = [] } var position: SIMD3 { get { return SIMD3(x: positionX, y: positionY, z: positionZ) } set { positionX = newValue.x positionY = newValue.y positionZ = newValue.z } } } @Model final class Preset: Identifiable { @Attribute(.unique) var id: UUID = UUID() var presetName: String var presetDesc: String? var presetAudioParams = [PresetParams]() // Many-To-Many Relationship. init(presetName: String, presetDesc: String? = nil) { self.presetName = presetName self.presetDesc =
1
0
160
Mar ’25
error: the replacement path doesn't exist <- how bad is this error, should i care - is it important?
I get this error, i have my own DIKit, and i want to use swiftdata for showing info from persisten model. It works all over the app, but i get this error with my .sheet. // JobCreationView.swift // Features // // Created by Jens Vik on 26/03/2025. // import SwiftUI import DesignKit import DIKit import PresentationKit import CoreKit import DomainKit import SwiftData public struct JobCreationView: View { @Binding var isPresented: Bool // Inject view model using DIKit's property wrapper @Injected((any JobCreationViewModelProtocol).self) private var viewModel // Form state @Injected(ModelContext.self) private var modelContext @State private var date = Date() @State private var isASAP = false @State private var price = @State private var jobType = Fiks @State private var description = // Available job types private let jobTypes = [Fiks, Fiksit] @Query private var userContexts: [UserContextModel] public init(isPresented: Binding) { self._isPresented = isPresented print(DEBUG: JobCreationView ini
1
0
124
Mar ’25
Reply to Multiple Executables in a Single Bundle Fails to Launch Others After Codesign
[quote='831680022, mmccartney, /thread/778169?answerId=831680022#831680022, /profile/mmccartney'] Each of our executables require the same entitlements: [/quote] This is potentially confusing, so let’s go to a table: Entitlement App Child ----------- --- ----- ….app-sandbox true true ….inherit - true ….cs.disable-library-validation true true ….files.user-selected.read-write true - ….network.client true - ….network.server true - In this table: App is your main application and Child is any program is spawns as a child process. - indicates that the entitlement shouldn’t be claimed at all. In general, you shouldn’t claim an entitlement with a false value, that just causes confusion. For the last three rows, you don’t need to, and mustn’t claim, the entitlement because these are part of your static sandboxed, which is what the second row is about. [quote='831680022, mmccartney, /thread/778169?answerId=831680022#831680022, /profile/mmccartney'] And if it's all going to TestFlight then I suppose it's restri
Topic: Code Signing SubTopic: General Tags:
Mar ’25
Reply to Does @Relationship(inverse:) create a memory leak?
No, there is no reference cycle and memory leak here. By using @Model, hat and owner are converted to computed properties, and some logics are implemented there to maintain the integrity of the relationship. Those details are barely documented, but conceptually, SwiftData takes care the integrity and so you don't need to worry about that. Best, —— Ziqiao Chen  Worldwide Developer Relations.
Mar ’25
Reply to Clarification on Family Controls Entitlement Coverage for App Extensions
Can you try only adding the capabilities and permissions on the main app when you archive? The extensions should inherit these, rather than need to also have a declaration.
Replies
Boosts
Views
Activity
Apr ’25
Reply to Multiple Executables in a Single Bundle Fails to Launch Others After Codesign
Getting back to this! Thanks again or the detailed response. The ugly truth is we need exec_b to be run from exec_a and by thirdparty tools that might need to call up it's UI. Think of exec_a as a sort of launcher program that orchestrates exec_b instances it's called up but so too do other parts of our pipeline, potentially. [quote='831858022, DTS Engineer, /thread/778169?answerId=831858022#831858022'] Add com.apple.application-identifier and com.apple.developer.team-identifier to your App. [/quote] Where should this be put? In the entitlements.plist we use while signing App? If we're to test the .inherit entitlement to just get exec_a launching exec_b, you're describing something like: # codesign other binaries... (macdeployqt does much of this work) # Sign child exec codesign ... --entitlements=./entitle_child.plist .../exec_b # Then sign the App (including the com.apple.application... tags) codesign ... --entitlements=./entitle_app.plist .../App.app Apologies if I'm missing the mark here. App val
Topic: Code Signing SubTopic: General Tags:
Replies
Boosts
Views
Activity
Apr ’25
Xcode 16.3 / macOS 15.4: SwiftData ModelContainer 在关联 iCloud Container 后初始化时崩溃
问题描述: 环境: Xcode 版本: 16.3 *macOS 版本: 15.4 项目类型: SwiftUI App with SwiftData 问题摘要: 当在 Xcode 项目的 Signing & Capabilities 中为启用了 iCloud 能力的应用关联一个具体的 iCloud Container 时,即使代码中并未显式启用 CloudKit 同步(例如,未在 ModelConfiguration 中设置 cloudKitDatabase),SwiftData 的 ModelContainer 在应用启动初始化时也会立即失败并导致崩溃。如果仅启用 iCloud 能力但不选择任何 Container,应用可以正常启动。此问题在使用空的 Schema([]) 进行测试时依然稳定复现。 复现步骤 (使用最小复现项目 - MRE): 使用 Xcode 16.3 创建一个新的 SwiftUI App 项目 (例如,命名为 CloudKitCrashTest)。 在创建时不要勾选 Host in CloudKit,或者,如果勾选了,先确保后续步骤覆盖相关设置。Storage 选择 None 或 SwiftData 均可复现。 修改 CloudKitCrashTestApp.swift 文件,添加 SwiftData 导入和基本的 ModelContainer 初始化逻辑。关键代码如下: import SwiftUI import SwiftData @main struct CloudKitCrashTestApp: App { let sharedModelContainer: ModelContainer init() { // 使用空 Schema 进行诊断 let schema = Schema([]) // *不* 指定 cloudKitDatabase let modelConfiguration = ModelConfiguration(schema: schema, isStoredInMemoryOnly: false) do { sharedModelContainer = try ModelContainer(for: schema, configurations: [modelConfi
Replies
2
Boosts
0
Views
464
Activity
Apr ’25
Reply to CloudKit not storing or updating public data in real time.
interferon, thanks for responding. Doing another google search for answers I learned that SwiftData and CloudKit only do private databases. So, I need to wait for the next best SwiftData update in order to have a public database. I can wait. So SwiftData and Cloudkit are not using public databases at this time.
Topic: Design SubTopic: General Tags:
Replies
Boosts
Views
Activity
Apr ’25
Missing report instance segments
I'm following the flow to get my reports data: get the requests (ONGOING or ONE_TIME_SNAPSHOT) for my app (https://api.appstoreconnect.apple.com/v1/apps/{{appID}}/analyticsReportRequests?filter%5BaccessType%5D=ONGOING) get the report (App Sessions Standard, for example) (https://api.appstoreconnect.apple.com/v1/analyticsReportRequests/{{requestID}}/reports?filter%5Bname%5D={{report}}) get the daily instances of the ONGOING request (https://api.appstoreconnect.apple.com/v1/analyticsReports/{{reportID}}/instances?filter%5Bgranularity%5D=DAILY) get the segments for the selected instance (https://api.appstoreconnect.apple.com/v1/analyticsReportInstances/{{instanceID}}/segments) This flow used to work fine, but recently I noticed that the earliest instances (mostly of processing date 2025-02-24 until 2025-02-27 return an error when I'm trying to get the instance segments usint the URL https://api.appstoreconnect.apple.com/v1/analyticsReportInstances/{{instanceID}}/segments. The error is the following: title: The s
Replies
0
Boosts
0
Views
140
Activity
Apr ’25
Reply to Need help with code signing.
It’s hard to offer a definitive answer to this because my focus is primarily technical and your relationship with your vendors is very much a business relationship. However, there are two standard ways to approach this. Both of them start with adding your developer to your team. From there: You can set their privileges such that they can do all the work on your behalf. See Developer > Support > Articles > Program Roles for info on what’s what there. You can give them limited privileges and have them send you an Xcode archive (.xcarchive), whereupon you deal with the final distribution step by loading that into Xcode. Share and Enjoy — Quinn “The Eskimo!” @ Developer Technical Support @ Apple let myEmail = eskimo + 1 + @ + apple.com
Topic: Code Signing SubTopic: General
Replies
Boosts
Views
Activity
Apr ’25
App crashes due to a third-party library we use making a bad memory access.
Is there a way to prevent or handle our application's crash if a third-party library makes a bad memory access? Basically, I want to know if using a buggy library (that causes bad memory access) will automatically make our application inherit those crashes, leading to our app crashing as well. If there is a way to prevent the crash, what methods can be used to do so? Thread 13: EXC_BAD_ACCESS (code=1, address=0x3a7d300)
Replies
2
Boosts
0
Views
234
Activity
Apr ’25
Using relationships in SortDescriptor crashing on release
If use a SortDescriptor for a model and sort by some attribute from a relationship, in DEBUG mode it all works fine and sorts. However, in release mode, it is an instant crash. SortDescriptor(.name, order: .reverse) ---- works SortDescriptor(.assignedUser?.name, order: .reverse) ---- works in debug but crash in release. What is the issue here, is it that SwiftData just incompetent to do this?
Replies
2
Boosts
0
Views
125
Activity
Mar ’25
Reply to Using any SwiftData Query causes app to hang
Thank you for the answer. I'll keep the printing function in mind. As for my original issue, I later found that it was likely due to 2 embedded NavigationStack. Removing the duplicated inner stack resolved the issue. I was able to continue, but got another hang with basically the same query. I am at the point where the time I've saved with the more concise syntax of SwiftData has been completely lost to debugging issues. I will revert back to CoreData. Even if it is more code, I feel like I have better control of the behaviour and life cycle.
Replies
Boosts
Views
Activity
Mar ’25
SwiftData Lightweight Migraton failed with VersionedSchema
Setup I am running a versionedSchema for my SwiftData model and attempting a migration. The new version contains a new attribute, with a type of a new custom enum defined in the @Model class, a default value, and a private(set). Migration was completed with a migrationPlan with nil values for willMigrate and didMigrate. Example - Previous Version @Model class MyNumber { var num: Int init() { // Init Code } } Example - Newest Version @Model class MyNumber { var num: Int private(set) var rounding: RoundAmount = MyNumber.RoundAmount.thirtyMinute init() { // Init Code } enum RoundAmount { case fiveMinute, tenMinute, thirtyMinute } } Issue Running this code, I get a swiftData error for “SwiftData/ModelCoders.swift:1585: nil value passed for a non-optional keyPath, /MyNumber.rounding” I assume this means a failure of the swiftData lightweight migration? I have reverted the version, removed private(set) and re-tried the migration with no success. Using the versionedSchema with mig
Replies
1
Boosts
0
Views
130
Activity
Mar ’25
SwiftData Many-To-Many Relationship: Failed to fulfill link PendingRelationshipLink
Hi there, I got two models here: Two Models, with Many-To-Many Relationship @Model final class PresetParams: Identifiable { @Attribute(.unique) var id: UUID = UUID() var positionX: Float = 0.0 var positionY: Float = 0.0 var positionZ: Float = 0.0 var volume: Float = 1.0 @Relationship(deleteRule: .nullify, inverse: Preset.presetAudioParams) var preset = [Preset]() init(position: SIMD3, volume: Float) { self.positionX = position.x self.positionY = position.y self.positionZ = position.z self.volume = volume self.preset = [] } var position: SIMD3 { get { return SIMD3(x: positionX, y: positionY, z: positionZ) } set { positionX = newValue.x positionY = newValue.y positionZ = newValue.z } } } @Model final class Preset: Identifiable { @Attribute(.unique) var id: UUID = UUID() var presetName: String var presetDesc: String? var presetAudioParams = [PresetParams]() // Many-To-Many Relationship. init(presetName: String, presetDesc: String? = nil) { self.presetName = presetName self.presetDesc =
Replies
1
Boosts
0
Views
160
Activity
Mar ’25
Reply to Swiftdata Thread 1: EXC_BREAKPOINT (code=1, subcode=0x1cc1698ec)
Hi there, I encountered the same error when defining mutual @Relationship references (one-to-many or many-to-many relationships) between two models. Have you found a solution? thx
Replies
Boosts
Views
Activity
Mar ’25
error: the replacement path doesn't exist <- how bad is this error, should i care - is it important?
I get this error, i have my own DIKit, and i want to use swiftdata for showing info from persisten model. It works all over the app, but i get this error with my .sheet. // JobCreationView.swift // Features // // Created by Jens Vik on 26/03/2025. // import SwiftUI import DesignKit import DIKit import PresentationKit import CoreKit import DomainKit import SwiftData public struct JobCreationView: View { @Binding var isPresented: Bool // Inject view model using DIKit's property wrapper @Injected((any JobCreationViewModelProtocol).self) private var viewModel // Form state @Injected(ModelContext.self) private var modelContext @State private var date = Date() @State private var isASAP = false @State private var price = @State private var jobType = Fiks @State private var description = // Available job types private let jobTypes = [Fiks, Fiksit] @Query private var userContexts: [UserContextModel] public init(isPresented: Binding) { self._isPresented = isPresented print(DEBUG: JobCreationView ini
Replies
1
Boosts
0
Views
124
Activity
Mar ’25
Reply to Multiple Executables in a Single Bundle Fails to Launch Others After Codesign
[quote='831680022, mmccartney, /thread/778169?answerId=831680022#831680022, /profile/mmccartney'] Each of our executables require the same entitlements: [/quote] This is potentially confusing, so let’s go to a table: Entitlement App Child ----------- --- ----- ….app-sandbox true true ….inherit - true ….cs.disable-library-validation true true ….files.user-selected.read-write true - ….network.client true - ….network.server true - In this table: App is your main application and Child is any program is spawns as a child process. - indicates that the entitlement shouldn’t be claimed at all. In general, you shouldn’t claim an entitlement with a false value, that just causes confusion. For the last three rows, you don’t need to, and mustn’t claim, the entitlement because these are part of your static sandboxed, which is what the second row is about. [quote='831680022, mmccartney, /thread/778169?answerId=831680022#831680022, /profile/mmccartney'] And if it's all going to TestFlight then I suppose it's restri
Topic: Code Signing SubTopic: General Tags:
Replies
Boosts
Views
Activity
Mar ’25
Reply to Does @Relationship(inverse:) create a memory leak?
No, there is no reference cycle and memory leak here. By using @Model, hat and owner are converted to computed properties, and some logics are implemented there to maintain the integrity of the relationship. Those details are barely documented, but conceptually, SwiftData takes care the integrity and so you don't need to worry about that. Best, —— Ziqiao Chen  Worldwide Developer Relations.
Replies
Boosts
Views
Activity
Mar ’25