Search results for

“SwiftData inheritance relationship”

4,980 results found

Post

Replies

Boosts

Views

Activity

Reply to Is there a way to prevent the app from coming to the foreground when accepting a call with a banner-type call kit in a VoIP app?
I'm developing a VoIP app. Currently, I'm using CallKit to control call acceptance and end-of-call processing. When a call comes in while using the phone, CallKit appears as a banner at the top of the screen. When I click Accept on the banner, the app opens and the call is received. (For OEMs, clicking the Accept button in the banner will accept the call as is.) Is there a way to prevent the app from coming to the foreground when accepting a call with a banner-type call kit in a VoIP app? No, not currently. When I click Accept on the banner, the app opens and the call is received. Yes. This has been how CallKit worked since the framework was introduced in iOS 10, where it inherited the existing iOS behavior. The call banner was introduced in iOS 14, but the behavior of CallKit app was not changed. I believe that decision was made to avoid disrupting existing apps since past experience had shown VoIP developers to be resistant to nearly any change. I'll also note that CallKit opening into the calling
Topic: App & System Services SubTopic: General Tags:
Dec ’25
Reply to CSIdentityQueryExecute - possible results access after release?
unique_cfref is just a std::unique_ptr wrapper that calls CFRelease when we go out of scope. Looks like something in OpenDirectory tries to access released data (weak references and delayed processing?). The problem seems to occur on macOS 15. No, that's not what's going on, though I can see why you might have thought that. The key details here are this note in the middle: 0x000166890010 is located 10946 bytes after 789838-byte region ASAN includes information about nearby allocations because there often is a relationship between allocations that are close to each other. However, the problem here is that 10946 bytes is 10KB, which isn't really all that close. It's possible there is some connection, but it's more likely that this was just the closest block ASAN could relate, not that they were actually tied to each other. Similarly, what the code is actually doing is converting raw bytes it received through XPC into plist data (Array/Dictionary/String/etc.), which your larger app wouldn't really have
Topic: App & System Services SubTopic: Core OS Tags:
Dec ’25
Reply to SwiftData .autosaveEnabled / rollback() trouble
One option is to create and work with a local instance of ModelContext in your view and then call save() or rollback (or simply discard it) on that local instance. Once you call save the changes will be propagated to the main context. One article about this can be found on https://www.hackingwithswift.com/quick-start/swiftdata/how-to-discard-changes-to-a-swiftdata-object or as part of this longer article, https://medium.com/@matgnt/the-art-of-swiftdata-in-2025-from-scattered-pieces-to-a-masterpiece-1fd0cefd8d87
Dec ’25
CloudKit CKRecordZone Deletion Issue
CloudKit CKRecordZone Deletion Issue Problem: CloudKit record zones deleted via CKDatabase.modifyRecordZones(deleting:) or CKModifyRecordZonesOperation are successfully removed but then reappear. I suspect they are automatically reinstated by CloudKit sync, despite successful deletion confirmation. Environment: SwiftData with CloudKit integration Custom CloudKit zones created for legacy zone-based sharing Observed Behavior: Create custom zone (e.g., TestZone1) via CKDatabase.modifyRecordZones(saving:) Copy records to zone for sharing purposes Delete zone using any CloudKit deletion API - returns success, no errors Immediate verification: Zone is gone from database.allRecordZones() After SwiftData/CloudKit sync or app restart: Zone reappears Reproduction: Tested with three different deletion methods - all exhibit same behaviour: modifyRecordZones(deleting:) async API CKModifyRecordZonesOperation (fire-and-forget) CKModifyRecordZonesOperation with result callbacks Zone deletion succeeds, chang
1
0
137
Dec ’25
Swift Data Undo
Trying to support undo & redo in an app that utilizes Swift Data and as with anything other than provided simplistic Apple demo examples the experience is not great. The problem: Im trying to build functionality that allows users to add items to an item group, where item and item group have a many-to-many relationship e.g. item group can hold many items and items can appear in multiple groups. When trying to do so with relatively simple setup of either adding or removing item group from items relationship array, I am pretty consistently met with a hard crash after performing undo & redo. Sometimes it works the first few undo & redos but 95% of the time would crash on the first one. Could not cast value of type 'Swift.Optional' (0x20a676be0) to 'Swift.Array' (0x207a2bc08). Where CodableStructModel is a Codable Value type inside Item. Adding and removing this relationship should be undoable & redoable as typical for Mac interaction and is supported by SwiftData
1
0
181
Dec ’25
EKReminder semantics: startDateComponents vs dueDateComponents vs alarms
Hi everyone, I'm building a task management app that layers on top of EventKit/Reminders. I'm also moderating /r/AppleReminders. I see a confusion around the semantics of dates on both the developer side and on the user side. I'm trying to map the standard productivity mental model to the EKReminder implementation and hitting some walls. In productivity contexts, a task tends to have three distinct dates: Start Date: When the task becomes actionable — Don’t alert the user before this date. Notification: When the device should buzz/ping the user — Meaning that they can get started on the task. Due Date: Hard deadline — If the system works well, tasks are meant to rarely be past-deadline; productivity systems are about meeting deadlines rather than about missing them. The EventKit Reality Here is what I’m seeing in practice, and I’m hoping someone can correct me if I’m wrong: Field Description In Practice (Reminders App) startDateComponents Docs say start date of the task Seemingly unused? I can set it via API,
1
0
164
Dec ’25
DEXT (IOUserSCSIParallelInterfaceController): Direct I/O Succeeds, but Buffered I/O Fails with Data Corruption on Large File Copies
Hi all, We are migrating a SCSI HBA driver from KEXT to DriverKit (DEXT), with our DEXT inheriting from IOUserSCSIParallelInterfaceController. We've encountered a data corruption issue that is reliably reproducible under specific conditions and are hoping for some assistance from the community. Hardware and Driver Configuration: Controller: LSI 3108 DEXT Configuration: We are reporting our hardware limitations to the framework via the UserReportHBAConstraints function, with the following key settings: // UserReportHBAConstraints... addConstraint(kIOMaximumSegmentAddressableBitCountKey, 0x20); // 32-bit addConstraint(kIOMaximumSegmentCountWriteKey, 129); addConstraint(kIOMaximumByteCountWriteKey, 0x80000); // 512KB Observed Behavior: Direct I/O vs. Buffered I/O We've observed that the I/O behavior differs drastically depending on whether it goes through the system file cache: 1. Direct I/O (Bypassing System Cache) -> 100% Successful When we use fio with the direct=1 flag, our read/write and data ve
13
0
601
Dec ’25
App Sandbox denies mach-register for Developer ID signed app but allows it for Apple Distribution signed app
I'm working on a multi-process macOS application (based on Chromium/Electron) that uses Mach ports for inter-process communication between the main app and its helper processes. Background I have an MAS build working successfully via TestFlight for internal testing. However, public TestFlight testing requires Apple review, and while waiting for that review, I wanted to provide a directly distributable build for external testers. I attempted to create a Developer ID signed build with App Sandbox enabled, expecting it to behave similarly to the MAS build. The Problem With App Sandbox enabled (com.apple.security.app-sandbox) and identical entitlements, I observe different behavior depending on the signing certificate: Apple Distribution certificate: App launches successfully, mach-register and mach-lookup work Developer ID certificate: App crashes at launch, mach-register is denied by sandbox The Console shows this sandbox violation for the Developer ID build: Sandbox: MyApp(13605) deny(1) mach-register XXXXXXXX
2
0
297
Dec ’25
SwiftData crash when enabling CloudKit for existing users (Free to Pro upgrade)
Hi, I am implementing a premium feature in my app where CloudKit syncing is available only for Pro users. The Workflow: Free Users: I initialize the ModelContainer with cloudKitDatabase: .none so their data stays local. Pro Upgrade: When a user purchases a subscription, I restart the container with cloudKitDatabase: .automatic to enable syncing. The Problem: If a user starts as Free (creates local data) and later upgrades to Pro, the app crashes immediately upon launch with the following error: Fatal error: Failed to create ModelContainer: SwiftDataError(_error: SwiftData.SwiftDataError._Error.loadIssueModelContainer, _explanation: nil) It seems that SwiftData fails to load the existing data once the configuration changes to expect a CloudKit-backed store. My Question: Is there a supported way to toggle CloudKit on for an existing local dataset without causing this crash? I want the user's existing local data to start syncing once they pay, but currently, it just crashes. My code: import Foundation i
1
0
216
Dec ’25
Reply to SwiftData
The SwiftData files can be found via the modelConfiguration.url property, typically in the program container's Application Support folder. If you have a ModelContainer, you can pass it to something like this: showDatabase.txt Which will print all the filenames and sizes for the sqlite databases as well as any support files for model attributes marked as external storage.
Dec ’25
Request Analytics Reports via POST Call
Hi everyone! When I attempt the Post Request using Postman, as shown in my attached curl, I receive the error { errors: [ { status: 405, code: METHOD_NOT_ALLOWED, title: The request method is not valid for the resource path., detail: The request method used for this request is not valid for the resource path. Please consult the documentation. } ] }. I have constructed the JWT correctly as an admin with correct private Key and Unix Times and I am able to send regular GET requests without issue and I can view the dashboards in App Store Connect. The described POST request is being rejected, although it says so in the documentation: https://developer.apple.com/documentation/appstoreconnectapi/post-v1-analyticsreportrequests. Curl: curl --location 'https://api.appstoreconnect.apple.com/v1/analyticsReportRequests' --header 'Content-Type: application/json' --header 'Authorization: Bearer XXX' --data '{ data: { type: analyticsReportRequests, attributes: { accessType: ONGOING }, relationships: { app: { data:
3
0
506
Nov ’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
Nov ’25
Reply to Is there a way to prevent the app from coming to the foreground when accepting a call with a banner-type call kit in a VoIP app?
I'm developing a VoIP app. Currently, I'm using CallKit to control call acceptance and end-of-call processing. When a call comes in while using the phone, CallKit appears as a banner at the top of the screen. When I click Accept on the banner, the app opens and the call is received. (For OEMs, clicking the Accept button in the banner will accept the call as is.) Is there a way to prevent the app from coming to the foreground when accepting a call with a banner-type call kit in a VoIP app? No, not currently. When I click Accept on the banner, the app opens and the call is received. Yes. This has been how CallKit worked since the framework was introduced in iOS 10, where it inherited the existing iOS behavior. The call banner was introduced in iOS 14, but the behavior of CallKit app was not changed. I believe that decision was made to avoid disrupting existing apps since past experience had shown VoIP developers to be resistant to nearly any change. I'll also note that CallKit opening into the calling
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
Dec ’25
Reply to CSIdentityQueryExecute - possible results access after release?
unique_cfref is just a std::unique_ptr wrapper that calls CFRelease when we go out of scope. Looks like something in OpenDirectory tries to access released data (weak references and delayed processing?). The problem seems to occur on macOS 15. No, that's not what's going on, though I can see why you might have thought that. The key details here are this note in the middle: 0x000166890010 is located 10946 bytes after 789838-byte region ASAN includes information about nearby allocations because there often is a relationship between allocations that are close to each other. However, the problem here is that 10946 bytes is 10KB, which isn't really all that close. It's possible there is some connection, but it's more likely that this was just the closest block ASAN could relate, not that they were actually tied to each other. Similarly, what the code is actually doing is converting raw bytes it received through XPC into plist data (Array/Dictionary/String/etc.), which your larger app wouldn't really have
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Dec ’25
Reply to SwiftData .autosaveEnabled / rollback() trouble
One option is to create and work with a local instance of ModelContext in your view and then call save() or rollback (or simply discard it) on that local instance. Once you call save the changes will be propagated to the main context. One article about this can be found on https://www.hackingwithswift.com/quick-start/swiftdata/how-to-discard-changes-to-a-swiftdata-object or as part of this longer article, https://medium.com/@matgnt/the-art-of-swiftdata-in-2025-from-scattered-pieces-to-a-masterpiece-1fd0cefd8d87
Replies
Boosts
Views
Activity
Dec ’25
CloudKit CKRecordZone Deletion Issue
CloudKit CKRecordZone Deletion Issue Problem: CloudKit record zones deleted via CKDatabase.modifyRecordZones(deleting:) or CKModifyRecordZonesOperation are successfully removed but then reappear. I suspect they are automatically reinstated by CloudKit sync, despite successful deletion confirmation. Environment: SwiftData with CloudKit integration Custom CloudKit zones created for legacy zone-based sharing Observed Behavior: Create custom zone (e.g., TestZone1) via CKDatabase.modifyRecordZones(saving:) Copy records to zone for sharing purposes Delete zone using any CloudKit deletion API - returns success, no errors Immediate verification: Zone is gone from database.allRecordZones() After SwiftData/CloudKit sync or app restart: Zone reappears Reproduction: Tested with three different deletion methods - all exhibit same behaviour: modifyRecordZones(deleting:) async API CKModifyRecordZonesOperation (fire-and-forget) CKModifyRecordZonesOperation with result callbacks Zone deletion succeeds, chang
Replies
1
Boosts
0
Views
137
Activity
Dec ’25
Swift Data Undo
Trying to support undo & redo in an app that utilizes Swift Data and as with anything other than provided simplistic Apple demo examples the experience is not great. The problem: Im trying to build functionality that allows users to add items to an item group, where item and item group have a many-to-many relationship e.g. item group can hold many items and items can appear in multiple groups. When trying to do so with relatively simple setup of either adding or removing item group from items relationship array, I am pretty consistently met with a hard crash after performing undo & redo. Sometimes it works the first few undo & redos but 95% of the time would crash on the first one. Could not cast value of type 'Swift.Optional' (0x20a676be0) to 'Swift.Array' (0x207a2bc08). Where CodableStructModel is a Codable Value type inside Item. Adding and removing this relationship should be undoable & redoable as typical for Mac interaction and is supported by SwiftData
Replies
1
Boosts
0
Views
181
Activity
Dec ’25
Reply to How to detect if Wifi is being used for CarPlay
Yes, iOS. Is getting to the SCDynamicStore not supposed to be possible on iOS? I inherited this code and it's always been there for me to use so somehow a previous developer added it and I never thought about it
Replies
Boosts
Views
Activity
Dec ’25
EKReminder semantics: startDateComponents vs dueDateComponents vs alarms
Hi everyone, I'm building a task management app that layers on top of EventKit/Reminders. I'm also moderating /r/AppleReminders. I see a confusion around the semantics of dates on both the developer side and on the user side. I'm trying to map the standard productivity mental model to the EKReminder implementation and hitting some walls. In productivity contexts, a task tends to have three distinct dates: Start Date: When the task becomes actionable — Don’t alert the user before this date. Notification: When the device should buzz/ping the user — Meaning that they can get started on the task. Due Date: Hard deadline — If the system works well, tasks are meant to rarely be past-deadline; productivity systems are about meeting deadlines rather than about missing them. The EventKit Reality Here is what I’m seeing in practice, and I’m hoping someone can correct me if I’m wrong: Field Description In Practice (Reminders App) startDateComponents Docs say start date of the task Seemingly unused? I can set it via API,
Replies
1
Boosts
0
Views
164
Activity
Dec ’25
DEXT (IOUserSCSIParallelInterfaceController): Direct I/O Succeeds, but Buffered I/O Fails with Data Corruption on Large File Copies
Hi all, We are migrating a SCSI HBA driver from KEXT to DriverKit (DEXT), with our DEXT inheriting from IOUserSCSIParallelInterfaceController. We've encountered a data corruption issue that is reliably reproducible under specific conditions and are hoping for some assistance from the community. Hardware and Driver Configuration: Controller: LSI 3108 DEXT Configuration: We are reporting our hardware limitations to the framework via the UserReportHBAConstraints function, with the following key settings: // UserReportHBAConstraints... addConstraint(kIOMaximumSegmentAddressableBitCountKey, 0x20); // 32-bit addConstraint(kIOMaximumSegmentCountWriteKey, 129); addConstraint(kIOMaximumByteCountWriteKey, 0x80000); // 512KB Observed Behavior: Direct I/O vs. Buffered I/O We've observed that the I/O behavior differs drastically depending on whether it goes through the system file cache: 1. Direct I/O (Bypassing System Cache) -> 100% Successful When we use fio with the direct=1 flag, our read/write and data ve
Replies
13
Boosts
0
Views
601
Activity
Dec ’25
App Sandbox denies mach-register for Developer ID signed app but allows it for Apple Distribution signed app
I'm working on a multi-process macOS application (based on Chromium/Electron) that uses Mach ports for inter-process communication between the main app and its helper processes. Background I have an MAS build working successfully via TestFlight for internal testing. However, public TestFlight testing requires Apple review, and while waiting for that review, I wanted to provide a directly distributable build for external testers. I attempted to create a Developer ID signed build with App Sandbox enabled, expecting it to behave similarly to the MAS build. The Problem With App Sandbox enabled (com.apple.security.app-sandbox) and identical entitlements, I observe different behavior depending on the signing certificate: Apple Distribution certificate: App launches successfully, mach-register and mach-lookup work Developer ID certificate: App crashes at launch, mach-register is denied by sandbox The Console shows this sandbox violation for the Developer ID build: Sandbox: MyApp(13605) deny(1) mach-register XXXXXXXX
Replies
2
Boosts
0
Views
297
Activity
Dec ’25
SwiftData crash when enabling CloudKit for existing users (Free to Pro upgrade)
Hi, I am implementing a premium feature in my app where CloudKit syncing is available only for Pro users. The Workflow: Free Users: I initialize the ModelContainer with cloudKitDatabase: .none so their data stays local. Pro Upgrade: When a user purchases a subscription, I restart the container with cloudKitDatabase: .automatic to enable syncing. The Problem: If a user starts as Free (creates local data) and later upgrades to Pro, the app crashes immediately upon launch with the following error: Fatal error: Failed to create ModelContainer: SwiftDataError(_error: SwiftData.SwiftDataError._Error.loadIssueModelContainer, _explanation: nil) It seems that SwiftData fails to load the existing data once the configuration changes to expect a CloudKit-backed store. My Question: Is there a supported way to toggle CloudKit on for an existing local dataset without causing this crash? I want the user's existing local data to start syncing once they pay, but currently, it just crashes. My code: import Foundation i
Replies
1
Boosts
0
Views
216
Activity
Dec ’25
Reply to SwiftData crash when enabling CloudKit for existing users (Free to Pro upgrade)
Hi everyone, I wanted to update that I found the issue and it was a mistake on my end, not a SwiftData bug. The crash loadIssueModelContainer was caused because I had a relationship in one of my models (CalendarModel) that wasn't marked as optional.
Replies
Boosts
Views
Activity
Dec ’25
Reply to SwiftData
The SwiftData files can be found via the modelConfiguration.url property, typically in the program container's Application Support folder. If you have a ModelContainer, you can pass it to something like this: showDatabase.txt Which will print all the filenames and sizes for the sqlite databases as well as any support files for model attributes marked as external storage.
Replies
Boosts
Views
Activity
Dec ’25
SwiftData
Is there a way to view the data saved when using swiftdata? Even after deleting all models, the storage space taken up by the app in Settings is too large.
Replies
2
Boosts
0
Views
746
Activity
Dec ’25
Request Analytics Reports via POST Call
Hi everyone! When I attempt the Post Request using Postman, as shown in my attached curl, I receive the error { errors: [ { status: 405, code: METHOD_NOT_ALLOWED, title: The request method is not valid for the resource path., detail: The request method used for this request is not valid for the resource path. Please consult the documentation. } ] }. I have constructed the JWT correctly as an admin with correct private Key and Unix Times and I am able to send regular GET requests without issue and I can view the dashboards in App Store Connect. The described POST request is being rejected, although it says so in the documentation: https://developer.apple.com/documentation/appstoreconnectapi/post-v1-analyticsreportrequests. Curl: curl --location 'https://api.appstoreconnect.apple.com/v1/analyticsReportRequests' --header 'Content-Type: application/json' --header 'Authorization: Bearer XXX' --data '{ data: { type: analyticsReportRequests, attributes: { accessType: ONGOING }, relationships: { app: { data:
Replies
3
Boosts
0
Views
506
Activity
Nov ’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
Nov ’25