Post

Replies

Boosts

Views

Activity

Title UNNotificationSound(named:) rejects bundled custom sounds and plays the default sound on macOS 26.6
I’m seeing what appears to be a regression in custom local-notification sounds on macOS 26.6. According to the UNNotificationSound documentation, a custom sound can be stored in the main application bundle and supplied using UNNotificationSound(named:). Environment: macOS 26.6 (25G72) Xcode 26.6 (17F113) Swift 6.3.3 Apple Silicon Sandboxed native macOS application Notification authorization granted Sounds enabled for the application in System Settings import AppKit import UserNotifications let center = UNUserNotificationCenter.current() let soundFilename = "notification_probe.aiff" guard Bundle.main.url( forResource: soundFilename, withExtension: nil ) != nil else { fatalError("Sound is missing from the application bundle") } let content = UNMutableNotificationContent() content.title = "Custom sound test" content.body = "This should play the bundled custom sound." content.sound = UNNotificationSound( named: UNNotificationSoundName(rawValue: soundFilename) ) // Ensure the application is inactive so macOS presents the notification. NSApp.hide(nil) try await Task.sleep(for: .milliseconds(250)) try await center.add( UNNotificationRequest( identifier: "custom_sound_test", content: content, trigger: nil ) ) The sound is correctly copied to: MyApp.app/Contents/Resources/notification_probe.aiff I tested two separate files: CAF and AIFF both files are shorter than 30 seconds and comply with the documented custom-sound requirements. Actual result: The notification is delivered and displayed correctly. macOS plays the default notification sound. The custom sound is not played. The unified log shows Notification Center receiving the correct custom filename, but ToneLibrary then rejects it: [com.apple.unc:sound] Playing notification sound { nam: notification_probe.aiff } for com.example.MyApp [com.apple.ToneLibrary:ToneManagement] Tone with identifier 'notification_probe.aiff' is neither in the collections for system or iTunes tones. Performed basic check for validity of tone with identifier 'notification_probe.aiff': NO. -toneWithIdentifierIsValid:(notification_probe.aiff): Returning NO. Immediately afterwards, SystemSoundServer plays the standard macOS notification sound. Immediately afterwards, SystemSoundServer plays the standard macOS notification sound At present, the only working solution is to submit a silent notification and play the sound independently through AudioToolbox, which loses the normal coupling between notification presentation and sound playback. Is this a bug or what ?
0
0
80
5d
SetFocusFilterIntent app cannot be copied to another Mac
I have recently added a SetFocusFilterIntent target extension to my app which is a system utility which goes into the menu bar(Application is agent = YES). I have followed the approach in the WWDC22 video introducing Focus Intent and I have created an App Groups to being able to make the Extension to communicate with my main app, however from when I did this sometimes when I run the app I do get this log line: Couldn't read values in CFPrefsPlistSource<0x97cd34700> (Domain: group.xxx.xxx.MyApp, User: kCFPreferencesAnyUser, ByHost: Yes, Container: (null), Contents Need Refresh: Yes): Using kCFPreferencesAnyUser with a container is only allowed for System Containers, detaching from cfprefsd Despite this the Focus mode integration is working correctly on my development Mac. However I used to Archive the app and then Copy the app to my MacBook but when I do that now my other Mac cannot open the app and it is giving me an error. If I revert this change then I can bring the app back to my other Mac as usual following the procedure: Product -> Archive. Then from the archiver: Distribute App -> Copy App. After that I copy the app generated to the App folder of my other MacBook but it doesn't open anymore. During the archival phase now I am even getting this warning: MyAppFocus.appex is an ExtensionKit extension and must be embedded in the parent app bundle's Extensions directory, but is embedded in the parent app bundle's ../../../BuildProductsPath/Release/MyApp.app/Contents/Extensions directory. How can I solve this issue? If I rollback the commit related to this SetFocusFilterIntent new feature the app can be Copied and moved to the other Mac as before. Is this related to the extension or to the fact that I had to use this new entitlement: com.apple.security.application-groups ?
0
1
541
Dec ’25
Using RAG on local documents from Foundation Model
I am watching a few WWDC sessions on Foundation Model and its usage and it looks pretty cool. I was wondering if it is possible to perform RAG on the user documents on the devices and entuallly on iCloud... Let's say I have a lot of pages documents about me and I want the Foundation model to access those information on the documents to answer questions about me that can be retrieved from the documents. How can this be done ? Thanks
4
2
594
Jun ’25
set struct or class field via Reflection
Hi, let's say I have a struct like the following:           struct Item {                 var text = ""             } I want to access the field by string and then set its value to some other string. I was able to access the property value through a Mirror: let item = Item() let mirroredObject = Mirror(reflecting: item) for (_, var attr) in mirroredObject.children.enumerated() {           attr.value = "Hello World!" } The problem is that setting the value of the struct field with attr.value doesn't really change its value... In python I was used to do something like: setattr(item, "text", "Hello World!") Is there any way to achieve the same result with Apple Swift? Thanks.
1
0
738
Dec ’22
Title UNNotificationSound(named:) rejects bundled custom sounds and plays the default sound on macOS 26.6
I’m seeing what appears to be a regression in custom local-notification sounds on macOS 26.6. According to the UNNotificationSound documentation, a custom sound can be stored in the main application bundle and supplied using UNNotificationSound(named:). Environment: macOS 26.6 (25G72) Xcode 26.6 (17F113) Swift 6.3.3 Apple Silicon Sandboxed native macOS application Notification authorization granted Sounds enabled for the application in System Settings import AppKit import UserNotifications let center = UNUserNotificationCenter.current() let soundFilename = "notification_probe.aiff" guard Bundle.main.url( forResource: soundFilename, withExtension: nil ) != nil else { fatalError("Sound is missing from the application bundle") } let content = UNMutableNotificationContent() content.title = "Custom sound test" content.body = "This should play the bundled custom sound." content.sound = UNNotificationSound( named: UNNotificationSoundName(rawValue: soundFilename) ) // Ensure the application is inactive so macOS presents the notification. NSApp.hide(nil) try await Task.sleep(for: .milliseconds(250)) try await center.add( UNNotificationRequest( identifier: "custom_sound_test", content: content, trigger: nil ) ) The sound is correctly copied to: MyApp.app/Contents/Resources/notification_probe.aiff I tested two separate files: CAF and AIFF both files are shorter than 30 seconds and comply with the documented custom-sound requirements. Actual result: The notification is delivered and displayed correctly. macOS plays the default notification sound. The custom sound is not played. The unified log shows Notification Center receiving the correct custom filename, but ToneLibrary then rejects it: [com.apple.unc:sound] Playing notification sound { nam: notification_probe.aiff } for com.example.MyApp [com.apple.ToneLibrary:ToneManagement] Tone with identifier 'notification_probe.aiff' is neither in the collections for system or iTunes tones. Performed basic check for validity of tone with identifier 'notification_probe.aiff': NO. -toneWithIdentifierIsValid:(notification_probe.aiff): Returning NO. Immediately afterwards, SystemSoundServer plays the standard macOS notification sound. Immediately afterwards, SystemSoundServer plays the standard macOS notification sound At present, the only working solution is to submit a silent notification and play the sound independently through AudioToolbox, which loses the normal coupling between notification presentation and sound playback. Is this a bug or what ?
Replies
0
Boosts
0
Views
80
Activity
5d
SetFocusFilterIntent app cannot be copied to another Mac
I have recently added a SetFocusFilterIntent target extension to my app which is a system utility which goes into the menu bar(Application is agent = YES). I have followed the approach in the WWDC22 video introducing Focus Intent and I have created an App Groups to being able to make the Extension to communicate with my main app, however from when I did this sometimes when I run the app I do get this log line: Couldn't read values in CFPrefsPlistSource<0x97cd34700> (Domain: group.xxx.xxx.MyApp, User: kCFPreferencesAnyUser, ByHost: Yes, Container: (null), Contents Need Refresh: Yes): Using kCFPreferencesAnyUser with a container is only allowed for System Containers, detaching from cfprefsd Despite this the Focus mode integration is working correctly on my development Mac. However I used to Archive the app and then Copy the app to my MacBook but when I do that now my other Mac cannot open the app and it is giving me an error. If I revert this change then I can bring the app back to my other Mac as usual following the procedure: Product -> Archive. Then from the archiver: Distribute App -> Copy App. After that I copy the app generated to the App folder of my other MacBook but it doesn't open anymore. During the archival phase now I am even getting this warning: MyAppFocus.appex is an ExtensionKit extension and must be embedded in the parent app bundle's Extensions directory, but is embedded in the parent app bundle's ../../../BuildProductsPath/Release/MyApp.app/Contents/Extensions directory. How can I solve this issue? If I rollback the commit related to this SetFocusFilterIntent new feature the app can be Copied and moved to the other Mac as before. Is this related to the extension or to the fact that I had to use this new entitlement: com.apple.security.application-groups ?
Replies
0
Boosts
1
Views
541
Activity
Dec ’25
Using RAG on local documents from Foundation Model
I am watching a few WWDC sessions on Foundation Model and its usage and it looks pretty cool. I was wondering if it is possible to perform RAG on the user documents on the devices and entuallly on iCloud... Let's say I have a lot of pages documents about me and I want the Foundation model to access those information on the documents to answer questions about me that can be retrieved from the documents. How can this be done ? Thanks
Replies
4
Boosts
2
Views
594
Activity
Jun ’25
set struct or class field via Reflection
Hi, let's say I have a struct like the following:           struct Item {                 var text = ""             } I want to access the field by string and then set its value to some other string. I was able to access the property value through a Mirror: let item = Item() let mirroredObject = Mirror(reflecting: item) for (_, var attr) in mirroredObject.children.enumerated() {           attr.value = "Hello World!" } The problem is that setting the value of the struct field with attr.value doesn't really change its value... In python I was used to do something like: setattr(item, "text", "Hello World!") Is there any way to achieve the same result with Apple Swift? Thanks.
Replies
1
Boosts
0
Views
738
Activity
Dec ’22
How can add songs to a playlist or create a new playlist from my APP?
Hi, I would like to be able to create a playlist from my app or add songs to an existing selected playlist in the user music library, How can I do that ? Is there an API in MusicKit to do that? The Shazam app is doing something similar with the My Shazam Songs playlist... Thanks
Replies
1
Boosts
0
Views
3.5k
Activity
May ’22