Explore the core architecture of the operating system, including the kernel, memory management, and process scheduling.

Posts under Core OS subtopic

Post

Replies

Boosts

Views

Activity

FSKit removeItem Not Being Called - Volume Operations Issue
I'm developing a custom file system using FSKit. After testing some example projects on github and have encountered an issue where the removeItem(_:named:fromDirectory:) method in my FSVolume.Operations implementation is not being invoked when attempting to delete files or directories through Finder or the command line. Environment: macOS: macOS 26.1 Xcode: 16.2 / 17A400 Sample Project: https://github.com/KhaosT/FSKitSample https://github.com/debox-network/FSKitBridge My volume implements the required FSVolume.Operations protocol with the following removeItem implementation: func removeItem( _ item: FSItem, named name: FSFileName, fromDirectory directory: FSItem ) async throws { logger.info("remove: \(name)") if let item = item as? MyFSItem, let directory = directory as? MyFSItem { directory.removeItem(item) } else { throw fs_errorForPOSIXError(POSIXError.EIO.rawValue) } } Steps to Reproduce: Mount the custom FSKit-based file system Create files using Finder or terminal (works correctly - createItem is called) Attempt to delete a file using: Terminal command: rm -rf /path/to/mounted/file option+cmd+delete force to delete file Expected Behavior: The removeItem(_:named:fromDirectory:) method should be called, logging "remove: [filename]" and removing the item from the directory's children collection. Actual Behavior: The removeItem method is never invoked. No logs appear from this method. The deletion operation either fails silently or returns an error, but the callback never occurs. Are there specific volume capabilities or entitlements required for removeItem to be invoked or are there any known issues with deletion operations in the current FSKit implementation? Any guidance would be greatly appreciated.
1
0
211
Dec ’25
Read ppse and card info
i'm trying to understand which entitlements i need to ask for in order to be able to read the credit card via NFC. I work for the bank and i'd like the read our card in order to verify there are the bank's credit card. The goal is to be able to use the card as a physical token to verify the user identity. on android we manage to do this without limitation if (await NfcManager.isSupported()) { await NfcManager.requestTechnology(NfcTech.IsoDep) const tag = await NfcManager.getTag() if (tag) toast.success("NFC Tag read successfully", { cancel: undefined, description: tag.id, id }) else toast.error("No NFC Tag found", { cancel: undefined, id }) const ppse = await NfcManager.isoDepHandler.transceive([ 0x00, 0xa4, 0x04, 0x00, 0x0e, 0x32, 0x50, 0x41, 0x59, 0x2e, 0x53, 0x59, 0x53, 0x2e, 0x44, 0x44, 0x46, 0x30, 0x31, 0x00, ]) logger.info("PPSE", ppse.map((c) => fromBase10ToHex(c, 2)).join(" ")) const select = await NfcManager.isoDepHandler.transceive([ 0x00, 0xa4, 0x04, 0x00, 0x07, 0xa0, 0x00, 0x00, 0x00, 0x04, 0x10, 0x10, 0x00, ]) logger.info("Select AID", select.map((c) => fromBase10ToHex(c, 2)).join(" ")) const gpo = await NfcManager.isoDepHandler.transceive([0x80, 0xa8, 0x00, 0x00, 0x02, 0x83, 0x00, 0x00]) logger.info("GPO", gpo.map((c) => fromBase10ToHex(c, 2)).join(" ")) const record = await NfcManager.isoDepHandler.transceive([0x00, 0xb2, 0x01, 0x14, 0x00]) logger.info("record: ", record.map((c) => fromBase10ToHex(c, 2)).join(" ")) logger.info("PAN", findTag(record, [0x5a])) logger.info("expiry", findTag(record, [0x5f, 0x24])?.reverse()) } but on ios we have restricted access and the ppse doesn't work but i can't find which entitlement i need to ask for, since HCE is to make the iphone into a nfc tag himself and the tap to pay is to pay with the iphone, both of those doesn't match my needs and i wouldn't be able to valid the requirement to get them into production. So i am wondering which entitlement i needs to ask for in order to be able to scan the card inside the bank app. We only care about our card
1
0
223
Nov ’25
FSKit - Retrieve Process ID?
Does FSKit support the ability to get the process information, such as the pid, when a process accesses a resource? Being able have the process context is important for implementing certain access patterns and security logging in some contexts. For instance, we have a system that utilizes (pre-FSKit) a FUSE mount that, depending on the process has different "views" and "access" based on the process id.
1
0
373
Nov ’25
FSKit Sandbox restrictions and automatic tests
Hi, I am currently in the process of writing a fskit extension. My goal is it to implement something similar like unionfs/mergerfs with fskit. For this to work my extension requires access to a set of user provided file paths. I use FSGenericURLResource with query parameters for this. But the sandbox restrictions make this impossible. This is why I tried to implement a privileged helper, but this makes it even more complicated and slower. Is there a way to disable the sandbox restrictions for the extension? I don't plan any app store publishing which makes this even more frustrating. When I remove the sandbox entitlement, I can't load the plugin with pluginkit -a anymore. Or is there any other recommend way, except a privileged helper? Another question I have on my mind: How to write proper tests for an fskit extension? You can load the extension via pluginkit -a and also remove it, but you can't enable it in the system panel. I have no idea how to build automatic tests with this restriction. Lovely greetings, Nils
4
0
285
Nov ’25
KDK for current stable version (26.1) missing
The current stable macOS version, 26.1 (build 25B78) is missing a corresponding Kernel Debug Kit (KDK) on the developer downloads page. This means I can't do any kernel-level development tasks currently. For example, if I try to build a new kernel collection with kmutil I get the message Missing Developer Kit: As of macOS 13.0, you will need to install a KDK matching your build 25B78 to rebuild kernel collections. but there is no build 25B78 KDK available to download. The latest 26.1 KDK on the download page is 25B5062e (from a beta I believe) and the final stable KDK for build 25B78 (which kernel development tools require) was never published. Is there any workaround for this to correctly do kernel-level development targeting the latest stable release, or a timeline for when the KDK will release? Thanks!
0
3
332
Nov ’25
Skip FileProvider folders without metadata
I want to traverse my local Google Drive folder to calculate the size of all the files on my drive. I'm not interested in files or directories that are not present locally. I use getattrlistbulk for traversing and it takes way too much time. I think it is because FileProvider tries to download metadata for the directories that are not yet materialised. Is there a way to skip non-materialised directories?
3
0
901
Nov ’25
FSKit removeItem Not Being Called
Environment macOS Version: 26.1 Xcode Version: 16.2 Description I'm developing a custom file system using FSKit and have encountered an issue where the removeItem(_:named:fromDirectory:) method in my FSVolume.Operations implementation is not being invoked when attempting to delete files or directories through Finder or the command line. Implementation My volume implements the required FSVolume.Operations protocol with the following removeItem implementation: func removeItem( _ item: FSItem, named name: FSFileName, fromDirectory directory: FSItem ) async throws { logger.info("remove: \(name)") if let item = item as? MyFSItem, let directory = directory as? MyFSItem { directory.removeItem(item) } else { throw fs_errorForPOSIXError(POSIXError.EIO.rawValue) } } Steps to Reproduce Mount the custom FSKit-based file system using: mount -F -t MyFS /dev/diskX /tmp/mountpoint Create files using Finder or terminal (works correctly - createItem is called) Attempt to delete a file using any of the following methods: Terminal command: rm -rf /path/to/mounted/file option + cmd + delete to remove the file in Finder Expected Behavior The removeItem(_:named:fromDirectory:) method should be called, logging "remove: [filename]" and removing the item from the directory's children collection. Actual Behavior The removeItem method is never invoked. No logs appear from this method in Console.app. The deletion operation either fails silently or returns an error, but the callback never occurs. Additional Context Working operations: Other operations work correctly including: createItem - files and directories can be created lookupItem - items can be looked up successfully enumerateDirectory - directory listing works read and write - file I/O operations work correctly Volume state: The volume is properly mounted and accessible Files can be created, read, and written successfully Volume capabilities configured: var supportedVolumeCapabilities: FSVolume.SupportedCapabilities { let capabilities = FSVolume.SupportedCapabilities() capabilities.supportsHardLinks = true capabilities.supportsSymbolicLinks = true capabilities.supportsPersistentObjectIDs = true capabilities.doesNotSupportVolumeSizes = true capabilities.supportsHiddenFiles = true capabilities.supports64BitObjectIDs = true capabilities.caseFormat = .insensitiveCasePreserving return capabilities } Questions Are there specific volume capabilities or entitlements required for removeItem to be invoked? Is there a specific way deletion operations need to be enabled in FSKit? Could this be related to how file permissions or attributes are set during createItem? Are there any known issues with deletion operations in the current FSKit implementation? Do I need to implement additional protocols or set specific flags to support item deletion? Any guidance would be greatly appreciated. Has anyone successfully implemented deletion operations in FSKit? Thank you!
0
0
248
Nov ’25
Hypervisor Framework on MacOS 26
I have a Hypervisor Framework App that works on MacOS 14 and 15 but fails on MacOS 26. To reproduce: hv_vm_config_t vm_config = hv_vm_config_create(); result = hv_vm_create(vm_config); result == HV_DENIED /* (0xfae94007) */ (from per the header file - not present on the online documentation) com.apple.security.hypervisor is set, no other VMs are running (no Virtualization Framework and no Hypervisor Framework). I have tried various entitlements with no success. Sandbox is off.
1
0
163
Nov ’25
File Provider : unable to trigger `fetchPartialContents(for:version:request:minimalRange:aligningTo:options:completionHandler:)` when opening files
https://developer.apple.com/documentation/fileprovider/nsfileproviderpartialcontentfetching/3923718-fetchpartialcontents fetchPartialContents(for:version:request:minimalRange:aligningTo:options:completionHandler:) I need to use this function to fetch contents of the files partially. But it seems I'm just unable to receive any callback when i try to open the file via double click on finder. I've tried to open files of different types and sizes but still i'm defaulting back to fetchContents(for:version:request:completionHandler:) . I've been thinking if there are any specific configurations or requirements that i have to meet , so i could trigger this callback function for all the fetch Operations for files ? If No, then where am i going wrong ?
2
0
982
Nov ’25
How to disable Finder "Move to Bin" action for non materialised files
In the context of a NSFileProviderReplicatedExtension I would like to only see the "Move to Bin" Finder action when files have been materlialised ( isDownloaded fileprovider attribute ) I thought it might be possible to get the isDownloaded attribute in my NSFileProviderItemProtocol class capabilities method but that doesn't seem to be the case. Possible ?
2
0
726
Nov ’25
Wakes (CalendarDate), although related UI settings are off
Hi everyone, I need help stopping the maintenance wakes due to "CalendarDate". All apparently related UI settings are off (Calendar: manual refresh, no notifications, time to travel OFF, Settings > Time & Date > Automatic time & date OFF) Two days ago, I got hourly dark wakes, but then I turned "Automatic time & date" off, and now I only got 5 wakes instead of 10, but I think this still shouldn't happen with all these settings off. I would appreciate any help. System: macOS 26.1 MacBook Pro 2019 pmset -g VACTDisabled 0 Currently in use: lidwake 1 lowpowermode 0 standbydelayhigh 0 proximitywake 0 standby 0 standbydelaylow 0 ttyskeepawake 0 hibernatemode 3 powernap 0 gpuswitch 2 hibernatefile /var/vm/sleepimage highstandbythreshold 50 displaysleep 10 womp 0 networkoversleep 0 sleep 0 (sleep prevented by bluetoothd, mds_stores) tcpkeepalive 0 halfdim 0 acwake 0 disksleep 10 pmset -g log | grep "due to" 2025-11-16 00:26:38 +0100 DarkWake DarkWake from Deep Idle [CDN] : due to EC.RTC/Maintenance Using AC (Charge:100%) 45 secs 2025-11-16 00:27:23 +0100 Sleep Entering Sleep state due to 'Maintenance Sleep':TCPKeepAlive=disabled Using AC (Charge:100%) 13728 secs 2025-11-16 04:16:11 +0100 DarkWake DarkWake from Deep Idle [CDN] : due to EC.RTC/Maintenance Using AC (Charge:100%) 45 secs 2025-11-16 04:16:56 +0100 Sleep Entering Sleep state due to 'Maintenance Sleep':TCPKeepAlive=disabled Using AC (Charge:100%) 7216 secs 2025-11-16 06:17:12 +0100 DarkWake DarkWake from Deep Idle [CDN] : due to EC.RTC/Maintenance Using AC (Charge:100%) 45 secs 2025-11-16 06:17:57 +0100 Sleep Entering Sleep state due to 'Maintenance Sleep':TCPKeepAlive=disabled Using AC (Charge:100%) 3616 secs 2025-11-16 07:18:13 +0100 DarkWake DarkWake from Deep Idle [CDN] : due to EC.RTC/Maintenance Using AC (Charge:100%) 45 secs 2025-11-16 07:18:58 +0100 Sleep Entering Sleep state due to 'Maintenance Sleep':TCPKeepAlive=disabled Using AC (Charge:100%) 3616 secs 2025-11-16 08:19:14 +0100 DarkWake DarkWake from Deep Idle [CDN] : due to EC.RTC/Maintenance Using AC (Charge:100%) 45 secs 2025-11-16 08:19:59 +0100 Sleep Entering Sleep state due to 'Maintenance Sleep':TCPKeepAlive=disabled Using AC (Charge:100%) 1457 secs log show --predicate '"SMCRTC"' --start "2025-11-16 00:00:00" --end "2025-11-16 08:00:00" --info --debug (showing only the sequence from the first dark wake) 2025-11-16 00:26:29.315541+0100 0x125b50 Default 0x0 0 0 kernel: (AppleSMCRTC) SMCRTC: setPowerState 1 2025-11-16 00:26:29.322608+0100 0x125a3e Default 0x0 0 0 kernel: (AppleSMCRTC) SMCRTC: [PowerByCalendarDate] 0/0/0 0:0:0 (0) 2025-11-16 00:26:29.322625+0100 0x125a3e Default 0x0 0 0 kernel: (AppleSMCRTC) SMCRTC: [PowerByCalendarDate] 0/0/0 0:0:0 (0) 2025-11-16 00:26:38.242885+0100 0x125c15 Default 0x0 0 0 kernel: (AppleSMCRTC) SMCRTC: [PowerByCalendarDate] 0/0/0 0:0:0 (0) 2025-11-16 00:26:38.242889+0100 0x125c15 Default 0x0 0 0 kernel: (AppleSMCRTC) SMCRTC: [PowerByCalendarDate] 0/0/0 0:0:0 (0) 2025-11-16 00:27:40.807018+0100 0x126175 Default 0x0 0 0 kernel: (AppleSMCRTC) SMCRTC: [MaintenanceWakeCalendarDate] 2025/11/16 3:16:0 (0) 2025-11-16 00:27:40.807038+0100 0x126175 Default 0x0 0 0 kernel: (AppleSMCRTC) SMCRTC: [MaintenanceWakeCalendarDate] 2025/11/16 3:16:0 (0) 2025-11-16 00:27:42.262812+0100 0x126290 Default 0x0 0 0 kernel: (AppleSMCRTC) SMCRTC: setPowerState 0 2025-11-16 00:27:42.262823+0100 0x126290 Default 0x0 0 0 kernel: (AppleSMCRTC) SMCRTC: setPowerState 0 2025-11-16 00:27:43.836823+0100 0x1262b2 Default 0x0 0 0 kernel: [143883.997279]: SMCRTC: setAlarmEnable 0xe0000280 2025-11-16 00:27:43.836830+0100 0x1262b2 Default 0x0 0 0 kernel: [143883.999744]: SMCRTC: enabled wake alarm (MaintenanceWakeCalendarDate) in 13697 seconds 2025-11-16 00:27:43.836836+0100 0x1262b2 Default 0x0 0 0 kernel: [143883.999845]: SMCRTC: setAlarmEnable 0xe0000300 2025-11-16 00:27:44.385470+0100 0x126209 Default 0x0 0 0 kernel: IOPlatformWakeAction -> AppleSMCRTC 2025-11-16 00:27:44.385474+0100 0x126209 Default 0x0 0 0 kernel: (AppleSMCRTC) SMCRTC: updated wake type to Maintenance 2025-11-16 00:27:44.385477+0100 0x126209 Default 0x0 0 0 kernel: (AppleSMCRTC) SMCRTC: updated wake type to Maintenance 2025-11-16 00:27:44.385481+0100 0x126209 Default 0x0 0 0 kernel: (AppleSMCRTC) SMCRTC: Maintenance 2025/11/16 03:16:00 2025-11-16 00:27:44.385485+0100 0x126209 Default 0x0 0 0 kernel: (AppleSMCRTC) SMCRTC: Maintenance 2025/11/16 03:16:00
5
0
166
Nov ’25
Weird crash: missing symbol Swift.AsyncIteratorProtocol.next()
I got several reports about our TestFlight app crashing unconditionally on 2 devices (iOS 18.1 and iOS 18.3.1) on app start with the following reason: Termination Reason: DYLD 4 Symbol missing Symbol not found: _$sScIsE4next7ElementQzSgyYa7FailureQzYKF (terminated at launch; ignore backtrace) The symbol in question demangles to (extension in Swift):Swift.AsyncIteratorProtocol.next() async throws(A.Failure) -> A.Element? Our deploy target is iOS 18.0, this symbol was introduced in Swift 6.0, we're using latest Xcode 16 now - everything should be working, but for some reason aren't. Since this symbol is quite rarely used directly, I was able to pinpoint the exact place in code related to it. Few days ago I added the following code to our app library (details omitted): public struct AsyncRecoveringStream<Base: AsyncSequence>: AsyncSequence { ... public struct AsyncIterator: AsyncIteratorProtocol { ... public mutating func next(isolation actor: isolated (any Actor)? = #isolation) async throws(Failure) -> Element? { ... } } } I tried to switch to Xcode 26 - it was still crashing on affected phone. Then I changed next(isolation:) to its older version, next(): public mutating func next() async throws(Failure) -> Element? And there crashes are gone. However, this change is a somewhat problematic, since I either have to lower Swift version of our library from 6 to 5 and we loose concurrency checks and typed throws or I'm loosing tests due to Swift compiler crash. Performance is also affected, but it's not that critical for our case. Why is this crash happening? How can I solve this problem or elegantly work around it? Thank you! 2025-10-09_17-13-31.7885_+0100-23e00e377f9d43422558d069818879042d4c5c2e.crash
3
0
425
Nov ’25
Can an iOS app programmatically detect if it's built for release or debug?
Is it possible for an iOS app to programmatically detect if its built for TestFlight/App Store distribution versus built for development? The motivation for doing this is so that the app can detect if a push server should send pushes using the Apple production server or the sandbox server - when the app sends the push token to the server, I'd like it to additionally send an indicator to the server so the server knows which of the Apple servers to use. Is there a way to achieve this? TIA
6
0
484
Nov ’25
Lock Contention in APFS/Kernel?
Hello! Some colleagues and work on Jujutsu, a version control system compatible with git, and I think we've uncovered a potential lock contention bug in either APFS or the Darwin kernel. There are four contributing factors to us thinking this is related to APFS or the Kernel: jj's testsuite uses nextest, a test runner for Rust that spawns each individual test as a separate process. The testsuite slowed down by a factor of ~5x on macOS after jj started using fsync. The slowdown increases as additional cores are allocated. A similar slowdown did not occur on ext4. Similar performance issues were reported in the past by a former Mercurial maintainer: https://gregoryszorc.com/blog/2018/10/29/global-kernel-locks-in-apfs/. My friend and colleague André has measured the test suite on an M3 Ultra with both a ramdisk and a traditional SSD and produced this graph: (The most thorough writeup is the discussion on this pull request.) I know I should file a feedback/bug report, but before I do, I'm struggling with profiling and finding kernel/APFS frames in my profiles so that I can properly attribute the cause of this apparent lock contention. Naively, I ran xctrace record --template 'Time Profiler' --output output.trace --launch /Users/dbarsky/.cargo/bin/cargo-nextest nextest run, and while that detected all processes spawned by nextest, it didn't record all processes as part of the same inspectable profile and didn't really show any frames from the kernel/APFS—I had to select individual processes. So I don't waste people's time and so that I can point a frame/smoking gun in the right system, how can I can use instruments to profile where the kernel and/or APFS are spending its time? Do I need to disable SIP?
9
1
518
Nov ’25
“iOS 26 + BGContinuedProcessingTask: Why does a CPU/ML-intensive job run 4-5× slower in background?”
Hello All, I’m a mobile-app developer working with iOS 26+ and I’m using BGContinuedProcessingTask to perform background work. My app’s workflow includes the following business logic: Loading images via PHImageRequest. Using a CLIP model to extract image embeddings. Using an .mlmodel-based model to further process those embeddings. For both model inferences I set computeUnits = .cpuAndNeuralEngine. When the app is moved to the background, I observe that the same workload(all three workload) becomes on average 4-5× slower than when the app is in the foreground. In an attempt to diagnose the slowdown, I tried to profile with Xcode Instruments, but since a debugger was attached, the performance in background appeared nearly identical to foreground. Even when I detached the debugger, the measured system resource metrics (process CPU usage, system CPU usage, memory, QoS class, thermal state) showed no meaningful difference. Below are some of the metrics I captured: Process CPU: 177% (Foreground) → 153% (Background) → ~-24.1% Still >1.5 cores of work. System CPU: 56.1% → 38.4% → ~-17.7% Process Memory: 244.8 MB → 218.1 MB QoS Class: userInitiated in both cases Thermal State: nominal in both cases Given these results, I’m finding it hard to pinpoint why the overall latency is so much worse when the app is backgrounded, even though the obvious metrics show little variation. I suspect the cause may involve P-core vs E-core scheduling, or internal hardware throttling/limit of Neural Engine usage, but I cannot find clear documentation or logging to confirm this. My question is: Does anyone know why a CPU (and Neural Engine)-intensive job like this would slow down so dramatically when using BGContinuedProcessingTask in the background on iOS 26+, despite apparent similar resource-usage metrics? Are there internal iOS scheduling/hardware-allocation behaviors (e.g., falling back to lower-performing cores when backgrounded) that might explain this? Any pointers to Apple technical notes, system logs, or instrumentation I might use to detect which cores or compute units are being used would be greatly appreciated. Thank you for your time and any guidance you can provide. Best regards,
1
0
449
Nov ’25
checkResourceIsReachableAndReturnError or fileExistsAtPath for security scoped resources
A security scoped bookmark can only be created for URLs that point to resources that exist. What is the preferred/correct API to use to determine if the resource exists? [NSFileManager fileExistsAtPath:] is more explicitly about existence, but might return NO if the app hasn't established access to the resource via an implicit or explicit startAccessingSecurityScopedResource? [NSURL checkResourceIsReachableAndReturnError] might explicitly deal with the latter issue (?), but might also return an error for other reasons than the resource not existing (?). Thanks!
4
0
161
Nov ’25
Error when materializing files
Hello, we have a file provider based macOS app. Around June we started receiving reports that our users have problems when opening files. Sometimes they get "Invalid argument" alerts after double-clicking on a dataless file. We receive similar errors when trying to materialize the files programmatically from our app (not FP extension)(*): "The operation could not be completed. Invalid argument" code: 22 domain: "NSPOSIXErrorDomain" underlyingError: "cannotMaterialize" code: 33 domain: "libfssync.VFSFileError" We also see those errors with matching timestamps in the output from fileproviderctl dump: > (...) update-item: 🔶 last:(...) (-1min27s) (...) error:'NSError: POSIX 22 "The operation couldn’t be completed. Invalid argument" Underlying={NSError: libfssync.VFSFileError 33 "cannotMaterialize" }}' domain:none category:<nil> (...) At the same time our file provider extension receives fetchPartialContents call or no call at all. If it receives the call it finishes with success and returns correct range: requestedRange: "{0, 15295}" returnedRange: "{0, 524288}" alignment: "16384" Sadly we don't know how to reproduce those issues. We will be grateful for any hints that could be useful in debugging. Some more context: if materializing a file fails with this error, subsequent materialization attempts fail similarly in local testing when downloading a file with the code below, or double-click, we only get regular fetchContents call file returned by fetchPartialContents should have correct size the app is built with XCode 16.1, customers reporting this issue have OS/FP versions: 24F74/2882.120.74 and 24G90/2882.140.30 (*) More or less the code that we use to materialize files func materializeURL(_ url: URL) throws { if try url.isDataless() { var error: NSError? = nil let coordinator = NSFileCoordinator(filePresenter: nil) coordinator.coordinate(readingItemAt: url, error: &error) { _ in } if let error { throw error } } } private extension URL { func isDataless() throws -> Bool { let downloadStatus = try self .resourceValues(forKeys: [.ubiquitousItemDownloadingStatusKey]) .ubiquitousItemDownloadingStatus return downloadStatus == .notDownloaded || downloadStatus == .none } }
2
0
211
Nov ’25
Unable to physically disconnect from the peripheral at the application level
Hello! I'm working on a mobile app that communicates with a peripheral via Bluetooth with security level 2 in a customised way, as there are also other communication protocols used. We use a bluetooth service with a specific UUID that has a write characteristic for sending data to the device and a notify characteristic for receiving data from the device. After connecting for the first time, a pairing prompt appears after successful connection and subscribing to notifications. When all is set, that is notifications are enabled, a handshake is performed and a communication session is established. There can be only one session for a bluetooth connection. So I have two questions: Regarding the pairing, is there any way that I can know the result of the pairing, so that I could start the handshake after it is accepted? What could be the best approach here? Asking because I noticed some instability on first connection (peripheral ignoring handshake). After disconnecting using Core Bluetooth, the system maintains the connection for some time before actually disconnecting. When opening the app shortly after killing the previous instance, it gets connected very quickly as it reuses the existing connection. The problem is, however, that the device wouldn't accept the new handshake and it is pretty much impossible to reuse previous session. In our use case we need a new BLE connection for each session. Is there any way I could forcibly disconnect from the device or enforce a new connection (not a reused one)? What might be the best approach here? The way I handle it now is by using retrieveConnectedPeripherals and if the device is found to be connected, I use scanning. If the device is advertising then we know it's not connected. Other than that we could also poll retrieveConnectedPeripherals and wait. But obviously it is not optimal, as the user has to wait longer than ususal. Other than that retrievePeripherals is used for getting the peripheral, if the app once found it during scanning. I saw this post describing similar issue, is it the only solution to implement API for disconnecting on the peripheral side?
4
0
341
Nov ’25
FSKit removeItem Not Being Called - Volume Operations Issue
I'm developing a custom file system using FSKit. After testing some example projects on github and have encountered an issue where the removeItem(_:named:fromDirectory:) method in my FSVolume.Operations implementation is not being invoked when attempting to delete files or directories through Finder or the command line. Environment: macOS: macOS 26.1 Xcode: 16.2 / 17A400 Sample Project: https://github.com/KhaosT/FSKitSample https://github.com/debox-network/FSKitBridge My volume implements the required FSVolume.Operations protocol with the following removeItem implementation: func removeItem( _ item: FSItem, named name: FSFileName, fromDirectory directory: FSItem ) async throws { logger.info("remove: \(name)") if let item = item as? MyFSItem, let directory = directory as? MyFSItem { directory.removeItem(item) } else { throw fs_errorForPOSIXError(POSIXError.EIO.rawValue) } } Steps to Reproduce: Mount the custom FSKit-based file system Create files using Finder or terminal (works correctly - createItem is called) Attempt to delete a file using: Terminal command: rm -rf /path/to/mounted/file option+cmd+delete force to delete file Expected Behavior: The removeItem(_:named:fromDirectory:) method should be called, logging "remove: [filename]" and removing the item from the directory's children collection. Actual Behavior: The removeItem method is never invoked. No logs appear from this method. The deletion operation either fails silently or returns an error, but the callback never occurs. Are there specific volume capabilities or entitlements required for removeItem to be invoked or are there any known issues with deletion operations in the current FSKit implementation? Any guidance would be greatly appreciated.
Replies
1
Boosts
0
Views
211
Activity
Dec ’25
Read ppse and card info
i'm trying to understand which entitlements i need to ask for in order to be able to read the credit card via NFC. I work for the bank and i'd like the read our card in order to verify there are the bank's credit card. The goal is to be able to use the card as a physical token to verify the user identity. on android we manage to do this without limitation if (await NfcManager.isSupported()) { await NfcManager.requestTechnology(NfcTech.IsoDep) const tag = await NfcManager.getTag() if (tag) toast.success("NFC Tag read successfully", { cancel: undefined, description: tag.id, id }) else toast.error("No NFC Tag found", { cancel: undefined, id }) const ppse = await NfcManager.isoDepHandler.transceive([ 0x00, 0xa4, 0x04, 0x00, 0x0e, 0x32, 0x50, 0x41, 0x59, 0x2e, 0x53, 0x59, 0x53, 0x2e, 0x44, 0x44, 0x46, 0x30, 0x31, 0x00, ]) logger.info("PPSE", ppse.map((c) => fromBase10ToHex(c, 2)).join(" ")) const select = await NfcManager.isoDepHandler.transceive([ 0x00, 0xa4, 0x04, 0x00, 0x07, 0xa0, 0x00, 0x00, 0x00, 0x04, 0x10, 0x10, 0x00, ]) logger.info("Select AID", select.map((c) => fromBase10ToHex(c, 2)).join(" ")) const gpo = await NfcManager.isoDepHandler.transceive([0x80, 0xa8, 0x00, 0x00, 0x02, 0x83, 0x00, 0x00]) logger.info("GPO", gpo.map((c) => fromBase10ToHex(c, 2)).join(" ")) const record = await NfcManager.isoDepHandler.transceive([0x00, 0xb2, 0x01, 0x14, 0x00]) logger.info("record: ", record.map((c) => fromBase10ToHex(c, 2)).join(" ")) logger.info("PAN", findTag(record, [0x5a])) logger.info("expiry", findTag(record, [0x5f, 0x24])?.reverse()) } but on ios we have restricted access and the ppse doesn't work but i can't find which entitlement i need to ask for, since HCE is to make the iphone into a nfc tag himself and the tap to pay is to pay with the iphone, both of those doesn't match my needs and i wouldn't be able to valid the requirement to get them into production. So i am wondering which entitlement i needs to ask for in order to be able to scan the card inside the bank app. We only care about our card
Replies
1
Boosts
0
Views
223
Activity
Nov ’25
FSKit - Retrieve Process ID?
Does FSKit support the ability to get the process information, such as the pid, when a process accesses a resource? Being able have the process context is important for implementing certain access patterns and security logging in some contexts. For instance, we have a system that utilizes (pre-FSKit) a FUSE mount that, depending on the process has different "views" and "access" based on the process id.
Replies
1
Boosts
0
Views
373
Activity
Nov ’25
FSKit Sandbox restrictions and automatic tests
Hi, I am currently in the process of writing a fskit extension. My goal is it to implement something similar like unionfs/mergerfs with fskit. For this to work my extension requires access to a set of user provided file paths. I use FSGenericURLResource with query parameters for this. But the sandbox restrictions make this impossible. This is why I tried to implement a privileged helper, but this makes it even more complicated and slower. Is there a way to disable the sandbox restrictions for the extension? I don't plan any app store publishing which makes this even more frustrating. When I remove the sandbox entitlement, I can't load the plugin with pluginkit -a anymore. Or is there any other recommend way, except a privileged helper? Another question I have on my mind: How to write proper tests for an fskit extension? You can load the extension via pluginkit -a and also remove it, but you can't enable it in the system panel. I have no idea how to build automatic tests with this restriction. Lovely greetings, Nils
Replies
4
Boosts
0
Views
285
Activity
Nov ’25
KDK for current stable version (26.1) missing
The current stable macOS version, 26.1 (build 25B78) is missing a corresponding Kernel Debug Kit (KDK) on the developer downloads page. This means I can't do any kernel-level development tasks currently. For example, if I try to build a new kernel collection with kmutil I get the message Missing Developer Kit: As of macOS 13.0, you will need to install a KDK matching your build 25B78 to rebuild kernel collections. but there is no build 25B78 KDK available to download. The latest 26.1 KDK on the download page is 25B5062e (from a beta I believe) and the final stable KDK for build 25B78 (which kernel development tools require) was never published. Is there any workaround for this to correctly do kernel-level development targeting the latest stable release, or a timeline for when the KDK will release? Thanks!
Replies
0
Boosts
3
Views
332
Activity
Nov ’25
Skip FileProvider folders without metadata
I want to traverse my local Google Drive folder to calculate the size of all the files on my drive. I'm not interested in files or directories that are not present locally. I use getattrlistbulk for traversing and it takes way too much time. I think it is because FileProvider tries to download metadata for the directories that are not yet materialised. Is there a way to skip non-materialised directories?
Replies
3
Boosts
0
Views
901
Activity
Nov ’25
TN3150: Getting ready for dataless files
Understand dataless files and how to minimize the performance impact as the system materializes them. View Technote TN3150 >
Replies
1
Boosts
0
Views
1.2k
Activity
Nov ’25
FSKit removeItem Not Being Called
Environment macOS Version: 26.1 Xcode Version: 16.2 Description I'm developing a custom file system using FSKit and have encountered an issue where the removeItem(_:named:fromDirectory:) method in my FSVolume.Operations implementation is not being invoked when attempting to delete files or directories through Finder or the command line. Implementation My volume implements the required FSVolume.Operations protocol with the following removeItem implementation: func removeItem( _ item: FSItem, named name: FSFileName, fromDirectory directory: FSItem ) async throws { logger.info("remove: \(name)") if let item = item as? MyFSItem, let directory = directory as? MyFSItem { directory.removeItem(item) } else { throw fs_errorForPOSIXError(POSIXError.EIO.rawValue) } } Steps to Reproduce Mount the custom FSKit-based file system using: mount -F -t MyFS /dev/diskX /tmp/mountpoint Create files using Finder or terminal (works correctly - createItem is called) Attempt to delete a file using any of the following methods: Terminal command: rm -rf /path/to/mounted/file option + cmd + delete to remove the file in Finder Expected Behavior The removeItem(_:named:fromDirectory:) method should be called, logging "remove: [filename]" and removing the item from the directory's children collection. Actual Behavior The removeItem method is never invoked. No logs appear from this method in Console.app. The deletion operation either fails silently or returns an error, but the callback never occurs. Additional Context Working operations: Other operations work correctly including: createItem - files and directories can be created lookupItem - items can be looked up successfully enumerateDirectory - directory listing works read and write - file I/O operations work correctly Volume state: The volume is properly mounted and accessible Files can be created, read, and written successfully Volume capabilities configured: var supportedVolumeCapabilities: FSVolume.SupportedCapabilities { let capabilities = FSVolume.SupportedCapabilities() capabilities.supportsHardLinks = true capabilities.supportsSymbolicLinks = true capabilities.supportsPersistentObjectIDs = true capabilities.doesNotSupportVolumeSizes = true capabilities.supportsHiddenFiles = true capabilities.supports64BitObjectIDs = true capabilities.caseFormat = .insensitiveCasePreserving return capabilities } Questions Are there specific volume capabilities or entitlements required for removeItem to be invoked? Is there a specific way deletion operations need to be enabled in FSKit? Could this be related to how file permissions or attributes are set during createItem? Are there any known issues with deletion operations in the current FSKit implementation? Do I need to implement additional protocols or set specific flags to support item deletion? Any guidance would be greatly appreciated. Has anyone successfully implemented deletion operations in FSKit? Thank you!
Replies
0
Boosts
0
Views
248
Activity
Nov ’25
Hypervisor Framework on MacOS 26
I have a Hypervisor Framework App that works on MacOS 14 and 15 but fails on MacOS 26. To reproduce: hv_vm_config_t vm_config = hv_vm_config_create(); result = hv_vm_create(vm_config); result == HV_DENIED /* (0xfae94007) */ (from per the header file - not present on the online documentation) com.apple.security.hypervisor is set, no other VMs are running (no Virtualization Framework and no Hypervisor Framework). I have tried various entitlements with no success. Sandbox is off.
Replies
1
Boosts
0
Views
163
Activity
Nov ’25
File Provider : unable to trigger `fetchPartialContents(for:version:request:minimalRange:aligningTo:options:completionHandler:)` when opening files
https://developer.apple.com/documentation/fileprovider/nsfileproviderpartialcontentfetching/3923718-fetchpartialcontents fetchPartialContents(for:version:request:minimalRange:aligningTo:options:completionHandler:) I need to use this function to fetch contents of the files partially. But it seems I'm just unable to receive any callback when i try to open the file via double click on finder. I've tried to open files of different types and sizes but still i'm defaulting back to fetchContents(for:version:request:completionHandler:) . I've been thinking if there are any specific configurations or requirements that i have to meet , so i could trigger this callback function for all the fetch Operations for files ? If No, then where am i going wrong ?
Replies
2
Boosts
0
Views
982
Activity
Nov ’25
How to disable Finder "Move to Bin" action for non materialised files
In the context of a NSFileProviderReplicatedExtension I would like to only see the "Move to Bin" Finder action when files have been materlialised ( isDownloaded fileprovider attribute ) I thought it might be possible to get the isDownloaded attribute in my NSFileProviderItemProtocol class capabilities method but that doesn't seem to be the case. Possible ?
Replies
2
Boosts
0
Views
726
Activity
Nov ’25
Wakes (CalendarDate), although related UI settings are off
Hi everyone, I need help stopping the maintenance wakes due to "CalendarDate". All apparently related UI settings are off (Calendar: manual refresh, no notifications, time to travel OFF, Settings > Time & Date > Automatic time & date OFF) Two days ago, I got hourly dark wakes, but then I turned "Automatic time & date" off, and now I only got 5 wakes instead of 10, but I think this still shouldn't happen with all these settings off. I would appreciate any help. System: macOS 26.1 MacBook Pro 2019 pmset -g VACTDisabled 0 Currently in use: lidwake 1 lowpowermode 0 standbydelayhigh 0 proximitywake 0 standby 0 standbydelaylow 0 ttyskeepawake 0 hibernatemode 3 powernap 0 gpuswitch 2 hibernatefile /var/vm/sleepimage highstandbythreshold 50 displaysleep 10 womp 0 networkoversleep 0 sleep 0 (sleep prevented by bluetoothd, mds_stores) tcpkeepalive 0 halfdim 0 acwake 0 disksleep 10 pmset -g log | grep "due to" 2025-11-16 00:26:38 +0100 DarkWake DarkWake from Deep Idle [CDN] : due to EC.RTC/Maintenance Using AC (Charge:100%) 45 secs 2025-11-16 00:27:23 +0100 Sleep Entering Sleep state due to 'Maintenance Sleep':TCPKeepAlive=disabled Using AC (Charge:100%) 13728 secs 2025-11-16 04:16:11 +0100 DarkWake DarkWake from Deep Idle [CDN] : due to EC.RTC/Maintenance Using AC (Charge:100%) 45 secs 2025-11-16 04:16:56 +0100 Sleep Entering Sleep state due to 'Maintenance Sleep':TCPKeepAlive=disabled Using AC (Charge:100%) 7216 secs 2025-11-16 06:17:12 +0100 DarkWake DarkWake from Deep Idle [CDN] : due to EC.RTC/Maintenance Using AC (Charge:100%) 45 secs 2025-11-16 06:17:57 +0100 Sleep Entering Sleep state due to 'Maintenance Sleep':TCPKeepAlive=disabled Using AC (Charge:100%) 3616 secs 2025-11-16 07:18:13 +0100 DarkWake DarkWake from Deep Idle [CDN] : due to EC.RTC/Maintenance Using AC (Charge:100%) 45 secs 2025-11-16 07:18:58 +0100 Sleep Entering Sleep state due to 'Maintenance Sleep':TCPKeepAlive=disabled Using AC (Charge:100%) 3616 secs 2025-11-16 08:19:14 +0100 DarkWake DarkWake from Deep Idle [CDN] : due to EC.RTC/Maintenance Using AC (Charge:100%) 45 secs 2025-11-16 08:19:59 +0100 Sleep Entering Sleep state due to 'Maintenance Sleep':TCPKeepAlive=disabled Using AC (Charge:100%) 1457 secs log show --predicate '"SMCRTC"' --start "2025-11-16 00:00:00" --end "2025-11-16 08:00:00" --info --debug (showing only the sequence from the first dark wake) 2025-11-16 00:26:29.315541+0100 0x125b50 Default 0x0 0 0 kernel: (AppleSMCRTC) SMCRTC: setPowerState 1 2025-11-16 00:26:29.322608+0100 0x125a3e Default 0x0 0 0 kernel: (AppleSMCRTC) SMCRTC: [PowerByCalendarDate] 0/0/0 0:0:0 (0) 2025-11-16 00:26:29.322625+0100 0x125a3e Default 0x0 0 0 kernel: (AppleSMCRTC) SMCRTC: [PowerByCalendarDate] 0/0/0 0:0:0 (0) 2025-11-16 00:26:38.242885+0100 0x125c15 Default 0x0 0 0 kernel: (AppleSMCRTC) SMCRTC: [PowerByCalendarDate] 0/0/0 0:0:0 (0) 2025-11-16 00:26:38.242889+0100 0x125c15 Default 0x0 0 0 kernel: (AppleSMCRTC) SMCRTC: [PowerByCalendarDate] 0/0/0 0:0:0 (0) 2025-11-16 00:27:40.807018+0100 0x126175 Default 0x0 0 0 kernel: (AppleSMCRTC) SMCRTC: [MaintenanceWakeCalendarDate] 2025/11/16 3:16:0 (0) 2025-11-16 00:27:40.807038+0100 0x126175 Default 0x0 0 0 kernel: (AppleSMCRTC) SMCRTC: [MaintenanceWakeCalendarDate] 2025/11/16 3:16:0 (0) 2025-11-16 00:27:42.262812+0100 0x126290 Default 0x0 0 0 kernel: (AppleSMCRTC) SMCRTC: setPowerState 0 2025-11-16 00:27:42.262823+0100 0x126290 Default 0x0 0 0 kernel: (AppleSMCRTC) SMCRTC: setPowerState 0 2025-11-16 00:27:43.836823+0100 0x1262b2 Default 0x0 0 0 kernel: [143883.997279]: SMCRTC: setAlarmEnable 0xe0000280 2025-11-16 00:27:43.836830+0100 0x1262b2 Default 0x0 0 0 kernel: [143883.999744]: SMCRTC: enabled wake alarm (MaintenanceWakeCalendarDate) in 13697 seconds 2025-11-16 00:27:43.836836+0100 0x1262b2 Default 0x0 0 0 kernel: [143883.999845]: SMCRTC: setAlarmEnable 0xe0000300 2025-11-16 00:27:44.385470+0100 0x126209 Default 0x0 0 0 kernel: IOPlatformWakeAction -> AppleSMCRTC 2025-11-16 00:27:44.385474+0100 0x126209 Default 0x0 0 0 kernel: (AppleSMCRTC) SMCRTC: updated wake type to Maintenance 2025-11-16 00:27:44.385477+0100 0x126209 Default 0x0 0 0 kernel: (AppleSMCRTC) SMCRTC: updated wake type to Maintenance 2025-11-16 00:27:44.385481+0100 0x126209 Default 0x0 0 0 kernel: (AppleSMCRTC) SMCRTC: Maintenance 2025/11/16 03:16:00 2025-11-16 00:27:44.385485+0100 0x126209 Default 0x0 0 0 kernel: (AppleSMCRTC) SMCRTC: Maintenance 2025/11/16 03:16:00
Replies
5
Boosts
0
Views
166
Activity
Nov ’25
Weird crash: missing symbol Swift.AsyncIteratorProtocol.next()
I got several reports about our TestFlight app crashing unconditionally on 2 devices (iOS 18.1 and iOS 18.3.1) on app start with the following reason: Termination Reason: DYLD 4 Symbol missing Symbol not found: _$sScIsE4next7ElementQzSgyYa7FailureQzYKF (terminated at launch; ignore backtrace) The symbol in question demangles to (extension in Swift):Swift.AsyncIteratorProtocol.next() async throws(A.Failure) -> A.Element? Our deploy target is iOS 18.0, this symbol was introduced in Swift 6.0, we're using latest Xcode 16 now - everything should be working, but for some reason aren't. Since this symbol is quite rarely used directly, I was able to pinpoint the exact place in code related to it. Few days ago I added the following code to our app library (details omitted): public struct AsyncRecoveringStream<Base: AsyncSequence>: AsyncSequence { ... public struct AsyncIterator: AsyncIteratorProtocol { ... public mutating func next(isolation actor: isolated (any Actor)? = #isolation) async throws(Failure) -> Element? { ... } } } I tried to switch to Xcode 26 - it was still crashing on affected phone. Then I changed next(isolation:) to its older version, next(): public mutating func next() async throws(Failure) -> Element? And there crashes are gone. However, this change is a somewhat problematic, since I either have to lower Swift version of our library from 6 to 5 and we loose concurrency checks and typed throws or I'm loosing tests due to Swift compiler crash. Performance is also affected, but it's not that critical for our case. Why is this crash happening? How can I solve this problem or elegantly work around it? Thank you! 2025-10-09_17-13-31.7885_+0100-23e00e377f9d43422558d069818879042d4c5c2e.crash
Replies
3
Boosts
0
Views
425
Activity
Nov ’25
Bluetooth 5 Extended Advertising and LE Coded PHY
When will Apple mobile phones support some of the optional features of Bluetooth 5... specifically Extended Advertising and LE Coded PHY? There are many applications that benefit from having this capability in the mobile phone.
Replies
6
Boosts
1
Views
1.4k
Activity
Nov ’25
Can an iOS app programmatically detect if it's built for release or debug?
Is it possible for an iOS app to programmatically detect if its built for TestFlight/App Store distribution versus built for development? The motivation for doing this is so that the app can detect if a push server should send pushes using the Apple production server or the sandbox server - when the app sends the push token to the server, I'd like it to additionally send an indicator to the server so the server knows which of the Apple servers to use. Is there a way to achieve this? TIA
Replies
6
Boosts
0
Views
484
Activity
Nov ’25
Lock Contention in APFS/Kernel?
Hello! Some colleagues and work on Jujutsu, a version control system compatible with git, and I think we've uncovered a potential lock contention bug in either APFS or the Darwin kernel. There are four contributing factors to us thinking this is related to APFS or the Kernel: jj's testsuite uses nextest, a test runner for Rust that spawns each individual test as a separate process. The testsuite slowed down by a factor of ~5x on macOS after jj started using fsync. The slowdown increases as additional cores are allocated. A similar slowdown did not occur on ext4. Similar performance issues were reported in the past by a former Mercurial maintainer: https://gregoryszorc.com/blog/2018/10/29/global-kernel-locks-in-apfs/. My friend and colleague André has measured the test suite on an M3 Ultra with both a ramdisk and a traditional SSD and produced this graph: (The most thorough writeup is the discussion on this pull request.) I know I should file a feedback/bug report, but before I do, I'm struggling with profiling and finding kernel/APFS frames in my profiles so that I can properly attribute the cause of this apparent lock contention. Naively, I ran xctrace record --template 'Time Profiler' --output output.trace --launch /Users/dbarsky/.cargo/bin/cargo-nextest nextest run, and while that detected all processes spawned by nextest, it didn't record all processes as part of the same inspectable profile and didn't really show any frames from the kernel/APFS—I had to select individual processes. So I don't waste people's time and so that I can point a frame/smoking gun in the right system, how can I can use instruments to profile where the kernel and/or APFS are spending its time? Do I need to disable SIP?
Replies
9
Boosts
1
Views
518
Activity
Nov ’25
“iOS 26 + BGContinuedProcessingTask: Why does a CPU/ML-intensive job run 4-5× slower in background?”
Hello All, I’m a mobile-app developer working with iOS 26+ and I’m using BGContinuedProcessingTask to perform background work. My app’s workflow includes the following business logic: Loading images via PHImageRequest. Using a CLIP model to extract image embeddings. Using an .mlmodel-based model to further process those embeddings. For both model inferences I set computeUnits = .cpuAndNeuralEngine. When the app is moved to the background, I observe that the same workload(all three workload) becomes on average 4-5× slower than when the app is in the foreground. In an attempt to diagnose the slowdown, I tried to profile with Xcode Instruments, but since a debugger was attached, the performance in background appeared nearly identical to foreground. Even when I detached the debugger, the measured system resource metrics (process CPU usage, system CPU usage, memory, QoS class, thermal state) showed no meaningful difference. Below are some of the metrics I captured: Process CPU: 177% (Foreground) → 153% (Background) → ~-24.1% Still >1.5 cores of work. System CPU: 56.1% → 38.4% → ~-17.7% Process Memory: 244.8 MB → 218.1 MB QoS Class: userInitiated in both cases Thermal State: nominal in both cases Given these results, I’m finding it hard to pinpoint why the overall latency is so much worse when the app is backgrounded, even though the obvious metrics show little variation. I suspect the cause may involve P-core vs E-core scheduling, or internal hardware throttling/limit of Neural Engine usage, but I cannot find clear documentation or logging to confirm this. My question is: Does anyone know why a CPU (and Neural Engine)-intensive job like this would slow down so dramatically when using BGContinuedProcessingTask in the background on iOS 26+, despite apparent similar resource-usage metrics? Are there internal iOS scheduling/hardware-allocation behaviors (e.g., falling back to lower-performing cores when backgrounded) that might explain this? Any pointers to Apple technical notes, system logs, or instrumentation I might use to detect which cores or compute units are being used would be greatly appreciated. Thank you for your time and any guidance you can provide. Best regards,
Replies
1
Boosts
0
Views
449
Activity
Nov ’25
checkResourceIsReachableAndReturnError or fileExistsAtPath for security scoped resources
A security scoped bookmark can only be created for URLs that point to resources that exist. What is the preferred/correct API to use to determine if the resource exists? [NSFileManager fileExistsAtPath:] is more explicitly about existence, but might return NO if the app hasn't established access to the resource via an implicit or explicit startAccessingSecurityScopedResource? [NSURL checkResourceIsReachableAndReturnError] might explicitly deal with the latter issue (?), but might also return an error for other reasons than the resource not existing (?). Thanks!
Replies
4
Boosts
0
Views
161
Activity
Nov ’25
Error when materializing files
Hello, we have a file provider based macOS app. Around June we started receiving reports that our users have problems when opening files. Sometimes they get "Invalid argument" alerts after double-clicking on a dataless file. We receive similar errors when trying to materialize the files programmatically from our app (not FP extension)(*): "The operation could not be completed. Invalid argument" code: 22 domain: "NSPOSIXErrorDomain" underlyingError: "cannotMaterialize" code: 33 domain: "libfssync.VFSFileError" We also see those errors with matching timestamps in the output from fileproviderctl dump: > (...) update-item: 🔶 last:(...) (-1min27s) (...) error:'NSError: POSIX 22 "The operation couldn’t be completed. Invalid argument" Underlying={NSError: libfssync.VFSFileError 33 "cannotMaterialize" }}' domain:none category:<nil> (...) At the same time our file provider extension receives fetchPartialContents call or no call at all. If it receives the call it finishes with success and returns correct range: requestedRange: "{0, 15295}" returnedRange: "{0, 524288}" alignment: "16384" Sadly we don't know how to reproduce those issues. We will be grateful for any hints that could be useful in debugging. Some more context: if materializing a file fails with this error, subsequent materialization attempts fail similarly in local testing when downloading a file with the code below, or double-click, we only get regular fetchContents call file returned by fetchPartialContents should have correct size the app is built with XCode 16.1, customers reporting this issue have OS/FP versions: 24F74/2882.120.74 and 24G90/2882.140.30 (*) More or less the code that we use to materialize files func materializeURL(_ url: URL) throws { if try url.isDataless() { var error: NSError? = nil let coordinator = NSFileCoordinator(filePresenter: nil) coordinator.coordinate(readingItemAt: url, error: &error) { _ in } if let error { throw error } } } private extension URL { func isDataless() throws -> Bool { let downloadStatus = try self .resourceValues(forKeys: [.ubiquitousItemDownloadingStatusKey]) .ubiquitousItemDownloadingStatus return downloadStatus == .notDownloaded || downloadStatus == .none } }
Replies
2
Boosts
0
Views
211
Activity
Nov ’25
Unable to physically disconnect from the peripheral at the application level
Hello! I'm working on a mobile app that communicates with a peripheral via Bluetooth with security level 2 in a customised way, as there are also other communication protocols used. We use a bluetooth service with a specific UUID that has a write characteristic for sending data to the device and a notify characteristic for receiving data from the device. After connecting for the first time, a pairing prompt appears after successful connection and subscribing to notifications. When all is set, that is notifications are enabled, a handshake is performed and a communication session is established. There can be only one session for a bluetooth connection. So I have two questions: Regarding the pairing, is there any way that I can know the result of the pairing, so that I could start the handshake after it is accepted? What could be the best approach here? Asking because I noticed some instability on first connection (peripheral ignoring handshake). After disconnecting using Core Bluetooth, the system maintains the connection for some time before actually disconnecting. When opening the app shortly after killing the previous instance, it gets connected very quickly as it reuses the existing connection. The problem is, however, that the device wouldn't accept the new handshake and it is pretty much impossible to reuse previous session. In our use case we need a new BLE connection for each session. Is there any way I could forcibly disconnect from the device or enforce a new connection (not a reused one)? What might be the best approach here? The way I handle it now is by using retrieveConnectedPeripherals and if the device is found to be connected, I use scanning. If the device is advertising then we know it's not connected. Other than that we could also poll retrieveConnectedPeripherals and wait. But obviously it is not optimal, as the user has to wait longer than ususal. Other than that retrievePeripherals is used for getting the peripheral, if the app once found it during scanning. I saw this post describing similar issue, is it the only solution to implement API for disconnecting on the peripheral side?
Replies
4
Boosts
0
Views
341
Activity
Nov ’25