Hi there,
I have an SwiftUI app that opens a user selected audio file (wave). For each audio file an additional file exists containing events that were extracted from the audio file. This additional file has the same filename and uses the extension bcCalls. I load the audio file using FileImporter view modifier and within access the audio file with a security scoped bookmark. That works well. After loading the audio I create a CallsSidecar NSFilePresenter with the url of the audio file. I make the presenter known to the NSFileCoordinator and upon this add it to the FileCoordinator. This fails with NSFileSandboxingRequestRelatedItemExtension: Failed to issue extension for; Error Domain=NSPOSIXErrorDomain Code=3 "No such process"
My Info.plist contains an entry for the document with NSIsRelatedItemType set to YES
I am using this kind of FilePresenter code in various live apps developed some years ago. Now when starting from scratch on a fresh macOS26 system with most current Xcode I do not manage to get it running. Any ideas welcome!
Here is the code:
struct ContentView: View {
@State private var sonaImg: CGImage?
@State private var calls: Array<CallMeasurements> = Array()
@State private var soundContainer: BatSoundContainer?
@State private var importPresented: Bool = false
var body: some View {
VStack {
Image(systemName: "globe")
.imageScale(.large)
.foregroundStyle(.tint)
Text("Hello, world!")
if self.sonaImg != nil {
Image(self.sonaImg!, scale: 1.0, orientation: .left, label: Text("Sonagram"))
}
if !(self.calls.isEmpty) {
List(calls) {aCall in
Text("\(aCall.callNumber)")
}
}
Button("Load sound file") {
importPresented.toggle()
}
}
.fileImporter(isPresented: $importPresented, allowedContentTypes: [.audio, UTType(filenameExtension: "raw")!], onCompletion: { result in
switch result {
case .success(let url):
let gotAccess = url.startAccessingSecurityScopedResource()
if !gotAccess { return }
if let soundContainer = try? BatSoundContainer(with: url) {
self.soundContainer = soundContainer
self.sonaImg = soundContainer.overviewSonagram(expectedWidth: 800)
let callsSidecar = CallsSidecar(withSoundURL: url)
let data = callsSidecar.readData()
print(data)
}
url.stopAccessingSecurityScopedResource()
case .failure(let error):
// handle error
print(error)
}
})
.padding()
}
}
The file presenter according to the WWDC 19 example:
class CallsSidecar: NSObject, NSFilePresenter {
lazy var presentedItemOperationQueue = OperationQueue.main
var primaryPresentedItemURL: URL?
var presentedItemURL: URL?
init(withSoundURL audioURL: URL) {
primaryPresentedItemURL = audioURL
presentedItemURL = audioURL.deletingPathExtension().appendingPathExtension("bcCalls")
}
func readData() -> Data? {
var data: Data?
var error: NSError?
NSFileCoordinator.addFilePresenter(self)
let coordinator = NSFileCoordinator.init(filePresenter: self)
NSFileCoordinator.addFilePresenter(self)
coordinator.coordinate(readingItemAt: presentedItemURL!, options: [], error: &error) {
url in
data = try! Data.init(contentsOf: url)
}
return data
}
}
And from Info.plist
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>bcCalls</string>
</array>
<key>CFBundleTypeName</key>
<string>bcCalls document</string>
<key>CFBundleTypeRole</key>
<string>None</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>com.apple.property-list</string>
</array>
<key>LSTypeIsPackage</key>
<false/>
<key>NSIsRelatedItemType</key>
<true/>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>wav</string>
<string>wave</string>
</array>
<key>CFBundleTypeName</key>
<string>Windows wave</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>com.microsoft.waveform-audio</string>
</array>
<key>LSTypeIsPackage</key>
<integer>0</integer>
<key>NSDocumentClass</key>
<string></string>
</dict>
</array>
Note that BatSoundContainer is a custom class for loading audio of various undocumented formats as well as wave, Flac etc. and this is working well displaying a sonogram of the audio.
Thx, Volker
Delve into the world of built-in app and system services available to developers. Discuss leveraging these services to enhance your app's functionality and user experience.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Created
Hi there,
How can I best understand the changes on the eSIM Installation wizard, i.e. on iOS 18 and later after an eSIM installation you used to get steps such as labeling the eSIM, deciding what to use for iMessage & FaceTime, what to use for mobile data, main voice line, etc.
Whereas on iOS 26 you are not prompted for these steps.
Which HomeKit API serves for the Home application scene (HMActionSet)-related functionality “Remove from Home View” and “Add to Home View”?
There must be a public API for that, for at the very least one 3rd party application shows/hides scenes appropriately as they are set up in Home; nevertheless, whatever I try, I can't find the API.
Thanks!
As the title states, I’ve been trying to emulate some older Direct9 games, and rosetta can’t handle it because of that
https://github.com/WineAndAqua/rosettax87 I’ve had to use this, but it really seems like something that I shouldn’t have to do
I’ve tried Wineskin, wine, D9VK, MoltenVK, GPTk, and the only thing that’s close to working is using devel wine + d9vk with the xrosetta87 running like its a VPN, and then you play
Without xrosetta87 it’s 0-0.5 FPS? with it, it’s like a buttery smooth 60+
Topic:
App & System Services
SubTopic:
Core OS
Tags:
Graphics and Games
macOS
Hypervisor
Game Porting Toolkit
There is a conflict in SwiftData (specifically when synced with CloudKit) when a @Model attribute shares the same name as a case within its assigned enum type. When this occurs, accessing the attribute on a model instance consistently returns the value corresponding to the enum case name, rather than the actual value persisted in the database.
Steps to Reproduce
Define an enumeration (e.g., Status) with a case that matches a planned property name (e.g., case status).
Create a SwiftData @Model that uses this enum.
Name the property in the model the same as the enum case.
Attempt to save and then retrieve the value.
Example Code
enum TaskStatus: String, Codable {
case status // The conflict source
case pending
case completed
}
@Model
class TodoItem {
// Conflict: Property name matches enum case name
var status: TaskStatus
init(status: TaskStatus) {
self.status = status
}
}
Expected Behavior
The property item.status should return the value stored in the database (e.g., .pending or .completed).
Actual Behavior
The property item.status consistently resolves to the enum case .status, ignoring the actual persisted data.
Topic:
App & System Services
SubTopic:
iCloud & Data
How should i write and not show this sensitive error?
Topic:
App & System Services
SubTopic:
General
Hey there, I’m wondering if there is a CRUD API for Apple Notes?
I just saw once that it’s possible through a Apple Script on Mac. But the problem for me is that the app should also run on iOS.
Does someone have an idea how to approach this?
Hello!
We develop a SAS driver and a service application for DAS devices.
When users in our application create a RAID array on the device:
On the 1st step, our dext driver mounts a new volume. At this step DiskUtil automatically tries to mount it. As there is no file system on the new volume - the MacOS system popup appears "The disk you attached was not readable by the computer"
On the 2nd step our application creates the file system on this new volume.
So we do not need this MacOS system popup to appear (as it may frustrate our users).
We found a way to disable the global auto mount but this solution also impacts on other devices (which is not good).
Are there any other possibilities to prevent the popup "The disk you attached was not readable by the computer" from appearing?
Summary
On Mac Studio systems (no built-in camera), macOS does not initialize camera services after a normal reboot if no physical camera is present. As a result, Continuity Camera does not appear anywhere in the system.
Observed behavior
System Information → Camera reports “No video capture devices were found.”
Continuity Camera (iPhone) is completely absent from camera lists.
Plugging in any USB UVC webcam immediately initializes camera services and causes both the USB camera and the iPhone (Continuity Camera) to appear.
The USB camera can then be unplugged and Continuity Camera continues working until the next reboot.
Reproduction steps
Use a Mac Studio (no built-in camera) on recent macOS.
Ensure no USB webcam or external camera is connected.
Reboot the Mac normally.
After login, open System Information → Camera.
Expected
Camera services should initialize even when no physical camera is present, allowing Continuity Camera to be available as the primary camera.
Actual
No camera devices are present unless a physical USB camera is connected at least once after boot.
This reproduces 100% of the time on Mac Studio and appears to be a camera service bootstrap issue where Continuity Camera cannot be the first camera device.
Issue has been filed via Feedback Assistant.
In a class, I call the following (edited to simplify, but it matches the real case).
If I do this:
func getData() -> someClass? {
_ = someURL.startAccessingSecurityScopedResource()
if let data = NSData(contentsOf: someURL as URL) {
do {
let unarchiver = try NSKeyedUnarchiver(forReadingFrom: data as Data)
print((unarchiver.decodeObject(of: [NSArray.self, someClass.self /* and few others*/], forKey: oneKey) as? someClass)?.aProperty)
if let result = unarchiver.decodeObject(of: [NSArray.self, someClass.self /* same other types*/], forKey: oneKey) as? someClass {
unarchiver.finishDecoding()
print("unarchived success")
return result
} else {
unarchiver.finishDecoding()
print("unarchiving failed")
return someClass()
}
}
catch {
return nil
}
}
I get a failure on log : unarchiving failed
But if I comment out the print(unarchiver.decodeObject) - line 8, it works and I get unarchived success
// print((unarchiver.decodeObject(of: [NSArray.self, someClass.self /* and few others*/], forKey: oneKey) as? someClass)?.aProperty)
However, when I do exactly the same for another class (I've compared line by line to be sure), it works even with the print statement.
What could be happening here ?
We are developing a macOS VPN application using NEPacketTunnelProvider with a custom encryption protocol.
We are using standard On-Demand VPN rules with Wi-Fi SSID matching but we want to add some additional feature to the native behaviour.
We want to control the 'conenect/disconnect' button status and allow the user to interact with the tunnel even when the on demand rule conditions are satisfied, is there a native way to do it?
In case we need to implement our custom on-demand behaviour we need to access to this information:
connected interface type
ssid name
and being informed when it changes so to trigger our logic, how to do it from the app side?
we try to use CWWiFiClient along with ssidDidChangeForWiFiInterface monitoring, it returns just the interface name en0 and not the wifi ssid name.
Is location access mandatory to access wifi SSID on macOS even if we have a NEPacketTunnelProvider?
Please note that we bundle our Network Extension as an App Extension (not SystemExtension).
We’re developing an enterprise VPN client for macOS using NetworkExtension (PacketTunnelProvider) with Always-On / On-Demand VPN, deployed via MDM.
On macOS 14.x and 15.x we observe the following log message from nesessionmanager:
nesessionmanager: NESMVPNSession[...] Resetting VPN On Demand
This most commonly occurs after sleep → wake.
After this happens, the VPN no longer reconnects automatically, even though isOnDemandEnabled remains true and On-Demand rules are still present.
Then a manual user action is required to reconnect.
Questions:
Is the “Resetting VPN On Demand” log message expected during sleep/wake transitions?
Under what conditions does macOS reset On-Demand VPN state?
Is there a supported way to detect or recover from this state programmatically?
Any guidance on expected behavior or best practices would be appreciated.
Dear Apple Engineers,
I am using NFCNDEFReaderSession to read information from NFC tags. When calling the begin method of the session, a system dialog/popover appears at the bottom of the screen. Is it possible to suppress or disable this dialog?
Thank you for your assistance.
Here is my demo code:
@IBAction func beginScanning(_ sender: Any) {
guard NFCNDEFReaderSession.readingAvailable else {
let alertController = UIAlertController(
title: "Scanning Not Supported",
message: "This device doesn't support tag scanning.",
preferredStyle: .alert
)
alertController.addAction(UIAlertAction(title: "OK", style: .default, handler: nil))
self.present(alertController, animated: true, completion: nil)
return
}
session = NFCNDEFReaderSession(delegate: self, queue: nil, invalidateAfterFirstRead: true)
session?.alertMessage = "Hold your iPhone near the item to learn more about it.
session?.begin()
}
Dear Apple Engineers:
My app utilizes the App Clip experience. I would like to prevent the App Clip card from appearing when the host app is running in the foreground. How can this be achieved?
I have observed that Alipay (in China) does not display an App Clip card when the device is tapped against a tag while the app is in the foreground, which indicates that this behavior is possible.
Thank you for your assistance.
I decode an object with NSKeyedArchiver (SecureCoding):
typealias BoolArray = Array<Array<Bool>>
let val = decoder.decodeObject(of: NSArray.self, forKey: someKey) as? BoolArray
I get the following log:
*** -[NSKeyedUnarchiver validateAllowedClass:forKey:] allowed unarchiving safe plist type ''NSNumber' (0x204cdbeb8) [/System/Library/Frameworks/Foundation.framework]' for key 'NS.objects', even though it was not explicitly included in the client allowed classes set: '{(
"'NSArray' (0x204cd5598) [/System/Library/Frameworks/CoreFoundation.framework]"
)}'. This will be disallowed in the future.
I changed by adding NSNumber.self in the list :
let val = decoder.decodeObject(of: [NSArray.self, NSNumber.self], forKey: someKey) as? BoolArray
No more warning in log.
Is there a reason for this ?
I’m hitting a specific edge case with background execution that I can’t figure out. I'm using Flutter for the UI, but all the logic handles are in Swift using CoreBluetooth and CoreLocation.
I need the app to wake up from a suspended state when it detects my specific BLE peripheral (OBD sensor), connect to it, and immediately start continuous location tracking for the duration of the drive.
If I start this process while the app is in the foreground, or very shortly after going to BG, it works perfectly. The app stays alive for the whole trip.
The issue only happens when the sequence starts from the background:
The app is suspended. scanForPeripherals wakes the app when the sensor is found.
In didDiscover, I immediately call locationManager.startUpdatingLocation().
locationd actually delivers updates successfully.
However, 5-15 minutes later, iOS suspends the app again.
Crucially, I never see the blue "Location In Use" pill on the status bar, even though I have showsBackgroundLocationIndicator = true set. Also, distance filter is set to None.
Logs for reference (around suspending)
locationd: {"msg":"Sending location to client","Client":"[appName]:","desiredAccuracy":"-1.000000"}
runningboardd: Invalidating assertion ... from originator \\\[osservice<com.apple.bluetoothd>:...\\\]
runningboardd: Removed last relative-start-date-defining assertion for process app<[appName]...>
runningboardd: Calculated state ... running-suspended
runningboardd: Suspending task
locationd: Client [appName]: disconnected
bluetoothd: State of application "[appName]" is now "suspended"
Questions
Why does invalidating the Bluetooth assertion cause an immediate suspend even though I called startUpdatingLocation() and am receiving updates?
Does the missing blue location pill imply that the OS never fully "accepted" the location session?
Is there a specific "handshake" required to transition from a BLE wake-up to a long-running location session? I'm wondering if I need to use a background task identifier to bridge the gap between the BLE wake and the location manager taking over.
More context:
Digging deeper in the comments, I just noticed the following patterns when the application is not suspended vs when it is recently suspended and got awaken by a BLE event.
Not suspended:
303948:Jan 23 20:59:35.640118 locationd[6491] <Debug>: {"msg":"Client is setting ContinuousBackgroundLocationRequested", "Client":"[appName]:", "ContinuousBackgroundLocationRequested":1}
303949:Jan 23 20:59:35.640155 locationd[6491] <Debug>: {"msg":"Allowing process assertion due to foreground-ish status", "ClientKeyPath":"[appName]:"}
Recently suspended and awaken by BLE:
564296:Jan 23 21:00:23.179125 locationd[6491] <Debug>: {"msg":"Client is setting ContinuousBackgroundLocationRequested", "Client":"[appName]:", "ContinuousBackgroundLocationRequested":1}
564298:Jan 23 21:00:23.179195 locationd[6491] <Notice>: {"msg":"#Warning Denying process assertion", "ClientKeyPath":"[appName]:"}
The assertion fails for the second case and that's why the app could not persist. Most importantly, following the logs in the second case, I see the following:
locationd[6491] <Notice>: {"msg":"computing freshAuthorizationContext", "Client":"[appName]:", "ClientDictionary":"{\n AlwaysServiceSession = 0;\n
I suspect that the flag AlwaysServiceSession being 0 has to do with process assertion being denied for location.
Topic:
App & System Services
SubTopic:
Maps & Location
Hello,
In my iOS app, I have a customer center where the user can see some details about its current subscription. I display things like the billing period, the price, the introductory offer state, the renewal date if it's not cancelled or the expiration date if it's cancelled, etc. From this screen, the user can open the subscription management sheet.
I want to detect if the user cancels the subscription from this sheet or from the App Store (when the app is running) so I can refresh the information displayed on my customer center.
I checked the asynchronous sequences provided by StoreKit 2 like Transaction.updates or Product.SubscriptionInfo.Status.updates and tested with a Sandbox account on my physical device with the app debugged using Xcode. But I noticed these sequences don't emit when I cancel the subscription in Sandbox.
Is this the expected behavior?
Is there a way to observe in real time if a user cancels the subscription?
I can still manually check when the sheet is dismissed but it's not ideal because I want to know even if the user cancel from outside of the app with the app running.
Thank you,
Axel
Topic:
App & System Services
SubTopic:
StoreKit
Tags:
Subscriptions
StoreKit Test
StoreKit
In-App Purchase
I get several warnings in log:
*** -[NSKeyedUnarchiver validateAllowedClass:forKey:] allowed unarchiving
safe plist type ''NSNumber' (0x204cdbeb8)
[/System/Library/Frameworks/Foundation.framework]' for key 'NS.objects',
even though it was not explicitly included in the client allowed classes set: '{(
"'NSArray' (0x204cd5598) [/System/Library/Frameworks/CoreFoundation.framework]"
)}'. This will be disallowed in the future.
I am not sure how to understand it:
I have removed every NSNumber.self in the allowed lists for decode. To no avail, still get the avalanche of warnings.
What is the key NS.objects about ?
What may allowed classes set: '{(
"'NSArray' be referring to ? An inclusion of NSArray.self in a list for decode ? The type of a property in a class ?
I have defined a class :
class Item: NSObject, NSSecureCoding {
var name : String = ""
var color : ColorTag = .black // defined as enum ColorTag: Int
var value : Int = 0
static var supportsSecureCoding: Bool {
return true
}
Its decoder includes the following print statement to start:
required init(coder decoder: NSCoder) {
print(#function, "item should not be nil", decoder.decodeObject(of: Item.self, forKey: someKey))
Another class uses it:
class AllItems: NSObject, NSSecureCoding {
var allItems : [Item]?
static var supportsSecureCoding: Bool {
return true
}
and decodes as follows
required init(coder decoder: NSCoder) {
super.init() // Not sure it is necessary
allItems = decoder.decodeObject(of: NSArray.self, forKey: mykey) as? [Item]
print(#function, allItems) // <<-- get nil
}
I note:
decoder returns nil at line 5
I have tried to change to
decoder.decodeObject(of: [NSArray.self, NSString.self, NSColor.self, NSNumber.self], forKey: mykey))
Still get nil
And, decoder of class Item is not called (no print in the log)
What am I missing ?
I have noticed race conditions on macOS when tearing down and re-configuring an NEPacketTunnelProvider.
My goal is to handle switching out one VPN profile for another identical/near identical one (I'll add some context for this below).
The flow that I have tested was to wait for the NEVPNStatusDidChange notification to report a NEVPNStatus.disconnected state, and then start the process of re-configuring the VPN with a new profile.
In practice however, I have noticed that I must wait a couple of seconds between NEVPNStatus.disconnected state being reported and setting up a new tunnel. Otherwise, the system routing table gets messed up but the VPN reports being in NEVPNStatus.connected state, resulting in a tunnel that appears healthy but can't be accessed.
With this, I wanted to ask if you have any suggestions on any OS items I can observer, in order to deterministically know that the system has fully cleaned up my packet tunnel, and that I am safe to configure another? This would be much more optimal than a hard-coded delay.
Additional context:
Jamf is a common solution for deploying MDM configuration profiles. However, in my tests, it doesn't support Apple's recommended approach of using the PayloadIdentifier to mark profiles for replacement, as PayloadIdentifiers are automatically updated to match the PayloadUUID of that same profile on upload. Although given what I've observed, I'm not sure the Apple recommended approach would work here in any case.
Additionally, it would be nice to transition from non-MDM to MDM cleanly, however, this also requires an indeterminate wait time between the non-MDM configuration being disconnected and subsequently removed, and the MDM one being configured.
With these scenarios, we need to be able to add a second configuration, with possibly identical VPN settings, then remove the old one, allowing the system to transition to the new configuration.
For the MDM case, the pattern I've noticed on the system is that when the current profile is suddenly deleted, the connection will go into disconnected state, then NEVPNConfigurationChange will fire. The new profile can be configured from NEVPNConfigurationChange, however some time is needed to avoid races.
For non-MDM, I had experimented with an approach of polling for MDM configurations appearing. When they do, I'd remove my previous notification observers, and set up a new NEVPNStatusDidChange notification observer, to remove the non-MDM VPN configuration after. it enters a disconnected state. Following the removal, I would call a function to reconfigure the VPN with new configuration. When this logic is in place, the call to stopVPNTunnel() is made. Again, a hardcoded delay is required between stopping and removing the old configuration and setting up a new one.
Thanks!