Posts under App & System Services topic

Post

Replies

Boosts

Views

Created

Contacts Provider Extension not removed from Contacts list after app uninstall on iOS 26
Hi, I’ve built an app that includes a Contacts Provider Extension (CPE). On iOS 18, I observed the expected behavior — when the main app is uninstalled, the corresponding CPE entry is also removed from the Contacts list. However, on iOS 26, this no longer happens. After uninstalling the app, the CPE remains visible and active in the Contacts list, even though the app is gone.
4
2
54
1w
Upgrading NEFilterDataProvider Causes System Network Interruption
Hi, when I perform an overlay installation via a PKG on macOS for an application containing the NEFilterDataProvider functionality, there is a chance that the entire system network becomes unreachable. Disabling the corresponding Content Filter in "System Settings > Network > Filters" immediately restores network connectivity. This issue does not occur every time, with a frequency of approximately 1 in 20 installation attempts.  The following details may help identify the problem: The Filter.app containing the NEFilterDataProvider resides within the main app's Resources directory, e.g., /Applications/Main.app/Contents/Resources/Filter.app Main.app is installed via a PKG; the issue typically occurs during an overlay installation of Main.app. The NEFilterDataProvider operates as a System Extension. The func handleNewFlow(_ flow: NEFilterFlow) -> NEFilterNewFlowVerdict {} returns .allow. Wireshark packet captures show TCP packets but no UDP packets; TCP handshakes cannot complete. Disabling the corresponding content filter in "System Settings > Network > Filters" restores the network; re-enabling it breaks connectivity again. After waiting for a period, approximately 30-60 minutes, network connectivity can recover automatically. What causes this and how can it be fixed? Any workarounds?
1
0
46
1w
APDU Command Execution Issues with Core Bluetooth and Secure Element Communication
I'm experiencing intermittent failures when executing APDU (Application Protocol Data Unit) commands through Core Bluetooth to communicate with external secure elements. The communication flow involves establishing a BLE connection, discovering services and characteristics, and then sending structured APDU commands for card management operations. While the initial connection and characteristic discovery work reliably, I'm encountering inconsistent behavior during APDU command execution where commands either timeout, return unexpected response codes, or fail to complete the expected transaction sequences. The issue appears to be more prevalent when sending multiple APDU commands in rapid succession or when the commands involve cryptographic operations. I've implemented proper error handling and retry mechanisms, but the failures seem to occur at the Core Bluetooth level rather than in my application logic. The peripheral device responds correctly to the same commands when tested with other platforms, suggesting the issue might be related to iOS-specific BLE behavior or timing constraints. I'm using standard Core Bluetooth APIs (CBPeripheral, CBCharacteristic) with proper delegate implementations and have verified that the peripheral remains connected throughout the operation. Has anyone encountered similar issues with APDU command execution over BLE on iOS, and are there any known workarounds or best practices for ensuring reliable command delivery and response handling?
0
0
13
1w
How to safely terminate hanging threads in launched agent context
Hello, In a launched agent, I need to call into a third‑party library that may occasionally hang. At present, these calls are made from a separate thread, but if the thread hangs it cannot be terminated (pthread_cancel/pthread_kill are ineffective). Would Apple recommend isolating this functionality in a separate process that can be force‑terminated if it becomes unresponsive, or is there a preferred approach for handling such cases in launched agents? Can I use the system call fork() in launched agent? Thank you in advance!
2
0
67
1w
NSFileProviderManager.getDomainsWithCompletionHandler failure
I am writing an NSFileProviderReplicatedExtension for my app. Every once in a while it will get to a point where NSFileProviderManager.getDomainsWithCompletionHandler { domains, error in DispatchQueue.main.async { if let error = error { completion(.failure(.domainQueryFailed(error))) } else { completion(.success(domains)) } } } this always fails, once this happens then regardless of what I do - clean build, restart machine, uninstall plugin nothing works. The only way to get back to a wokring state is a full reinstall of the OS. It seems like when this happens Finder gets to a weird irrecoverable state that only a restart can fix. When it fails the error is always : The application cannot be used right now. the only way out is reisntall the OS. When this happened last time, I was advised to the use the debugging profile: https://developer.apple.com/forums/thread/797053 I now have that and have the log which is 300MB file, where do I upload it to? My machine is in that state, is there anything else I can run or diagnose to address this?
2
0
73
1w
BGContinuedProcessingTask what's the point?
Hi, This post is coming from frustration of working on using BGContinuedProcessingTask for almost 2 weeks, trying to get it to actually complete in the background after the app is backgrounded. My process will randomlly finish and not finish and have no idea why. I'm properly using and setting task?.progress.totalUnitCount = [some number] task?.progress.completedUnitCount = [increment as processed] I know this, because it all looks propler as long as the app insn't backgrounded. So it's not a progress issue. The task will ALWAYS complete. The device has full power, as it is plugged in as I run from within Xcode. So, it's not a power issue. Yes, the process will take a few minutes, but I thought that is BGContinuedProcessingTask purpose in iOS 26. For long running process that a user could place in the background and leave the app, assuming the process would actually finish. Why bother introducing a feature that only works with short tasks that don't actually need long running time in the first place.
7
0
118
1w
For receiving audio in PushtoTalk, channelManager(_:didActivate:) not called when app receives first push after backgrounding
I'm implementing the PushToTalk framework and have encountered an issue where channelManager(_:didActivate:) is not called under specific circumstances. What works: App is in foreground, receives PTT push → didActivate is called ✅ App receives audio in foreground, then is backgrounded → subsequent pushes trigger didActivate ✅ What doesn't work: App is launched, user joins channel, then immediately backgrounds PTT push arrives while app is backgrounded incomingPushResult is called, I return .activeRemoteParticipant(participant) The system UI shows the speaker name correctly However, didActivate is never called Audio data arrives via WebSocket but cannot be played (no audio session) Setup: Channel joined successfully before backgrounding UIBackgroundModes includes push-to-talk No manual audio session activation (setActive) anywhere in my code AVAudioEngine setup only happens inside didActivate delegate method Issue persists even after channel restoration via channelDescriptor(restoredChannelUUID:) Question: Is this expected behavior or a bug? If expected, what's the correct approach to handle incoming PTT audio when the app is backgrounded and hasn't received audio while in the foreground yet?
1
0
49
1w
Apple Tap to Pay transaction fails with ProximityReader.PaymentCardReaderSession.ReadError error 13
iPhone is throwing an error when starting Apple Tap to Pay transaction (other iPhones using the same merchant account working as expected) Error: Card reading failed due to unknown error: The operation couldn’t be completed. (ProximityReader.PaymentCardReaderSession.ReadError error 13.) We have tried full factory reset on the iPhone multiple times but still having the same issue. As mentioned issue is specific to one iPhone and other iPhones attached to the same merchant account have no issues taking Apple Tap to Pay transactions. Given the error is unknown / not documented, is it possible to get an explanation of what does error 13 means or what is causing it so we can troubleshoot accordingly? Full logs: readCancelled readyForTap readCancelled readyForTap userInterfaceDismissed Card reading failed due to unknown error: The operation couldn’t be completed. (ProximityReader.PaymentCardReaderSession.ReadError error 13.) readCancelled readyForTap readCancelled readyForTap readCancelled readyForTap userInterfaceDismissed Card reading failed due to unknown error: The operation couldn’t be completed. (ProximityReader.PaymentCardReaderSession.ReadError error 13.) readCancelled readyForTap userInterfaceDismissed Card reading failed due to unknown error: The operation couldn’t be completed. (ProximityReader.PaymentCardReaderSession.ReadError error 13.) readCancelled readyForTap readCancelled readyForTap updateProgress(100) updateProgress(99) updateProgress(98) updateProgress(96) updateProgress(95) updateProgress(94) updateProgress(93) updateProgress(92) updateProgress(91) updateProgress(90) updateProgress(89) updateProgress(88) updateProgress(87) updateProgress(86) updateProgress(85) updateProgress(84) updateProgress(82) updateProgress(81) updateProgress(80) updateProgress(79) updateProgress(78) updateProgress(77) updateProgress(75) updateProgress(74) updateProgress(73) updateProgress(72) updateProgress(69) updateProgress(68) updateProgress(67) updateProgress(66) updateProgress(65) updateProgress(64) updateProgress(62) updateProgress(60) updateProgress(59) updateProgress(58) updateProgress(57) updateProgress(56) updateProgress(55) updateProgress(54) updateProgress(53) updateProgress(52) updateProgress(48) updateProgress(47) updateProgress(45) updateProgress(44) updateProgress(43) updateProgress(41) updateProgress(40) updateProgress(39) updateProgress(37) updateProgress(36) updateProgress(34) updateProgress(33) updateProgress(32) updateProgress(31) updateProgress(30) updateProgress(25) updateProgress(22) updateProgress(19) updateProgress(18) updateProgress(17) updateProgress(15) updateProgress(14) updateProgress(13) updateProgress(12) updateProgress(10) updateProgress(9) updateProgress(8) updateProgress(7) updateProgress(5) updateProgress(4) updateProgress(3) Card reading failed due to unknown error: The operation couldn’t be completed. (ProximityReader.PaymentCardReaderSession.ReadError error 12.) userInterfaceDismissed readCancelled readyForTap readCancelled readyForTap userInterfaceDismissed Card reading failed due to unknown error: The operation couldn’t be completed. (ProximityReader.PaymentCardReaderSession.ReadError error 12.) readCancelled readyForTap readCancelled readyForTap readCancelled readyForTap Card reading failed due to unknown error: The operation couldn’t be completed. (ProximityReader.PaymentCardReaderSession.ReadError error 12.) userInterfaceDismissed readCancelled readyForTap notReady Card reading failed due to unknown error: The operation couldn’t be completed. (ProximityReader.PaymentCardReaderSession.ReadError error 12.) userInterfaceDismissed readCancelled readyForTap readCancelled userInterfaceDismissed Card reading failed due to unknown error: The operation couldn’t be completed. (ProximityReader.PaymentCardReaderSession.ReadError error 12.) readCancelled readyForTap Card reading failed due to unknown error: The operation couldn’t be completed. (ProximityReader.PaymentCardReaderSession.ReadError error 12.) userInterfaceDismissed readCancelled readyForTap readCancelled readyForTap userInterfaceDismissed Card reading failed due to unknown error: The operation couldn’t be completed. (ProximityReader.PaymentCardReaderSession.ReadError error 12.) readCancelled readyForTap readCancelled readyForTap readCancelled readyForTap readCancelled readyForTap Card reading failed due to unknown error: The operation couldn’t be completed. (ProximityReader.PaymentCardReaderSession.ReadError error 12.) userInterfaceDismissed readCancelled readyForTap readCancelled readyForTap userInterfaceDismissed Card reading failed due to unknown error: The operation couldn’t be completed. (ProximityReader.PaymentCardReaderSession.ReadError error 12.) readCancelled readyForTap Card reading failed due to unknown error: The operation couldn’t be completed. (ProximityReader.PaymentCardReaderSession.ReadError error 12.) userInterfaceDismissed readCancelled readyForTap readCancelled readyForTap
1
0
40
1w
Balancing implicit startAccessingSecurityScopedResource
If I'm reading this guide correctly, macOS will automatically/implicitly startAccessingSecurityScopedResource for files opened via drag to Dock icon or NSOpenPanel. And I'm expected to call stopAccessingSecurityScopedResource to balance it once I'm done. Does that mean that if I don't, I'm leaking kernel resources as per the docs? If you fail to relinquish your access to file-system resources when you no longer need them, your app leaks kernel resources. If sufficient kernel resources leak, your app loses its ability to add file-system locations to its sandbox, such as with Powerbox or security-scoped bookmarks, until relaunched. What is this limit in practice for macOS and iOS? I've seen number ranging from 1000-2500. From my testing, iOS does not provide the same implicit startAccessingSecurityScopedResource when using UIDocumentPickerViewController. Is this a correct observation/per design? Now, in the cases where I'm creating an NSURL by resolving a saved bookmark, I'm expected to explicitly startAccessingSecurityScopedResource. Based on this, from what I can tell, this means that I can't universally call startAccessingSecurityScopedResource whenever I access a resource by URL, balanced with a stopAccessingSecurityScopedResource when done, as depending on how I got the URL it might already be implicitly started. Is this a correct observation? Do I need to explicitly check whether I'm on iOS (never implicit?), or macOS (sometimes implicit?), and selectively startAccessingSecurityScopedResource based on every call site that may give me a security-scoped file? If so, is there a complete list of the entrypoints that may give me such files (file dialog, drag and drop, etc)? Thanks!
4
0
77
1w
Guideline 2.1 - Performance - App Completeness
Apple review says , my app displayed an error when we attempted to purchase subscriptions. Please review the details and resources below and complete the next steps. Device type: iPad Air (5th generation) OS version: iPadOS 26.0.1 Next Steps When validating receipts on your server, your server needs to be able to handle a production-signed app getting its receipts from Apple’s test environment. The recommended approach is for your production server to always validate receipts against the production App Store first. If validation fails with the error code "Sandbox receipt used in production," you should validate against the test environment instead. Question: Is it due to Device being used by reviewer or is it really from my code. As my code relies on Apple infrastructure for purchases and all things. Initially i did had subscription reporting api for receipt handling and all.When i went through with ChatGPT it did say that issue is due to half baked subscription module on my server. So i decided not to send any Subscription related things to backend, now it's Apple only and on App side. Is it correct fix ? Or do i need to fix backend even though i have no use for it ? My team did test in sandbox env via internal testing that time we had no issues. And all was tested using Mobile devices, that's why i still have question just to be sure these errors are due to devices or not? Screenshot shared by Apple team did show they got a error popup saying Something went wrong : Unable to complete request. I am trying to reproduce in development but can't. Anyone had got same issue before and has information on how to resolve and test for it will be helpful. Thanks Shikhar Sahu
0
0
36
1w
App Clip unavailable
Issue with App Clip Card Showing "App Clip unavailable" for DIGI LIVE App In my DIGI LIVE application, I have an App Clip configured for iOS 17.6+ (the file exceeds the 15 MB limit), and I have made all the necessary preparations for the App Clip to work correctly. However, the App Clip card constantly displays an "App Clip unavailable" error for various users (depending on their system language). The URL associated with the App Clip invocation is: https://ar.digi-live.de The AASA file is located at /.well-known/apple-app-site-association and contains the required fields for the App Clip: { "applinks": { "details": [ { "appIDs": ["N9QR6LF765.de.digilive.app"], "components":[ { "#": "no_universal_links", "exclude": true, "comment": "Matches any URL whose fragment equals no_universal_links and instructs the system not to open it as a universal link" }, { "/": "*", "comment": "Matches any URL like ar.digi-live.de" } ] } ] }, "appclips": { "apps": ["N9QR6LF765.de.digilive.app.Clip"] } } If I use the default App Clip link (https://appclip.apple.com/id?p=de.digilive.app.Clip) to launch it, the "App Clip unavailable" error no longer appears. But if I delete the App Clip from the settings, the error comes back, and it can only be launched again using the default link. It feels like the problem is with the App Clip loading at the moment the App Clip card is triggered — it simply fails to load. Video https://storage.yandexcloud.net/mmrs/files/digilive/IMG_2259.mp4
1
1
76
1w
Posting a local notifications (or alert) from a launch agent
My Mac app has a launch agent (within the app bundle) that works great without the app running. There are some occasions where I need to display an alert and ask the user to launch the app to handle the issue. I thought about using UNUserNotificationCenter but I'm not able to make it work from the agent. I'm asking for authorization as follows: [center requestAuthorizationWithOptions:(UNAuthorizationOptionAlert | UNAuthorizationOptionSound | UNAuthorizationOptionBadge) completionHandler:^(BOOL granted, NSError * _Nullable error) { NSLog(@"authorization request completion. Granted: %@, error: %@ (%@)",granted?@"YES":@"NO",error, [error localizedDescription]); }]; And I'm trying to post the notification as follows: content.title = @"Your App Name"; content.body = @"Click the button to open the app"; content.sound = [UNNotificationSound defaultSound]; UNNotificationRequest *request = [UNNotificationRequest requestWithIdentifier:[[NSUUID UUID] UUIDString] content:content trigger:nil]; [center addNotificationRequest:request withCompletionHandler:^(NSError * _Nullable error) { if (error) { NSLog(@"Error showing notification: %@ %@", error, [error localizedDescription]); } }]; When running I'm getting asked to authorize, I authorize and all seems OK in system settings but I'm not able send any notifications. addNotificationRequest results in UNErrorCodeNotificationsNotAllowed error. I tried this with the authorization request inside the main app, or inside the agent, with the same results. When trying to post the notification from within the app, it does work, but that's not what I need. Is posting notifications from within the launch agent not possible at all, or is there anything here that I'm missing. TIA
2
0
78
1w
Why is CoreNFC unavailable from App Extensions (appex)? Any supported workarounds for authenticators?
Hi everyone — I’m developing an iOS passkey/password manager where the private key material must be stored on a physical device (NFC card / USB token). I’m hitting a hard limitation: CoreNFC is not available for use from app extensions, which prevents an appex (e.g. password/credential provider or other extension) from talking directly to an NFC card during an authentication flow.  My questions: 1. Is there any plan to make CoreNFC (or some limited NFC-API) available to app extensions in a future iOS version? If not, could Apple clarify why (security/entitlements/architecture reasons)? 2. Are there any recommended/approved workarounds for a passkey manager extension that needs to access a physical NFC token during authentication? (For example: background tag reading that launches the containing app, or some entitlement for secure NFC card sessions.) I’ve read about background tag reading, but that seems to be about system/OS handling of tags rather than giving extensions direct NFC access.  3. Is the only supported pattern for my use case to have the containing app perform NFC operations and then share secrets with the extension via App Groups / Keychain Sharing / custom URL flow? (I’m already evaluating App Groups / Keychain access groups for secure sharing, but I’d like official guidance.)  Implementation details that may help responders: • Target: iOS (latest SDK), building a Credential Provider / password manager extension (appex). • Intended physical token: NFC smartcard / ISO7816 contactless (so CoreNFC APIs like NFCISO7816Tag would be ideal). • Security goals: private key never leaves the physical token; extension should be able to trigger/sign during a browser/app AutoFill flow. Possible alternatives I’m considering (open to feedback): designing the UX so that the extension opens the main app (only possible for Today widget in a supported way) which runs the NFC flow and stores/returns a short-lived assertion to the extension. Are any of these patterns sanctioned / recommended by Apple for credential providers?  Thanks — any pointers to docs, entitlement names, or example apps/samples would be extremely helpful.
1
0
62
1w
How to completely uninstall the old kext driver?
Hi, On macOS 11 and earlier versions, we provided users with the following script to uninstall our kext driver: sudo pkgutil --only-files --files com.magewell.ProCapture | tr '\n' '\0' | xargs -n 1 -0 sudo rm -vf sudo pkgutil --only-dirs --files com.magewell.ProCapture | grep ProCapture[^/]*$ | tr '\n' '\0' | xargs -n 1 -0 sudo rm -rvf sudo pkgutil --forget com.magewell.ProCapture sudo kextcache -system-caches However, this script no longer works on macOS 13 and returns the following error: It looks like you're trying to update the system caches. As of macOS 11, the personality cache is no longer in use for keeping kext matching information up-to-date. For more information, see `man kmutil`. This indicates we can no longer use kextcache -system-caches to clear our driver cache. This creates an issue where even after installing the new dext driver, the dext driver cannot run due to the presence of the old kext driver. We've tried various methods but haven't been able to completely uninstall the old kext driver - after every new system update, the old kext reappears. The specific process is as follows: This is the sequence I followed in my latest test - Device is running macOS 13 Ventura w/ 4247 Pro Capture kext driver installed kmutil inspect | grep -i magewell - this returns references to the kext files in /Library/Extensions, which is expected because I have not yet removed the 4247 kext driver - then I ran the following combination of your removal script and my removal steps: cd / sudo rm -r /Library/Extensions/ProCaptureDriver.kext sudo rm -r /Library/Extensions/ProCaptureEvent.kext sudo rm /System/Volumes/Preboot/*/boot/*/System/Library/Caches/com.apple.kernelcaches/kernelcache.auxkc* sudo pkgutil --only-files --files com.magewell.ProCapture | tr '\n' '\0' | xargs -n 1 -0 sudo rm -vf sudo pkgutil --only-dirs --files com.magewell.ProCapture | grep ProCapture[^/]*$ | tr '\n' '\0' | xargs -n 1 -0 sudo rm -rvf sudo pkgutil --forget com.magewell.ProCapture sudo kextcache --clear-staging sudo kcditto sudo kmutil install --update-preboot sudo shutdown -r now - After this I ran 'kmutil inspect | grep -i magewell' and got no results, which seems good but... - then I ran the upgrade to macOS 15.7 Sequoia - Afterwards I ran 'kmutil inspect | grep -i magewell' and it returned references to the old /Library/Extensions kexts again, although the files no longer exist in /Library/Extensions - I then ran my cleanup process again (slightly different for Sequoia-available commands): sudo rm /System/Volumes/Preboot/*/boot/*/System/Library/Caches/com.apple.kernelcaches/kernelcache.auxkc* sudo kextcache --clear-staging sudo kmutil rebuild sudo kcditto sudo kmutil install --update-preboot sudo shutdown -r now - Then I ran 'kmutil inspect | grep -i magewell' and got no results again - As a next test I ran a minor update to macOS 15.7.1, then ran 'kmutil inspect | grep -i magewell' and the references to the old kexts came back again We have indeed identified a solution to address this issue: kmutil trigger-panic-medic --volume-root /Volumes/<YourVolumeName> However, this method requires booting into Recovery Mode, which is unacceptable for many of our customers. Especially for those who need bulk remote management, having personnel physically operate each machine one by one is simply not feasible. Therefore, is there a method to completely uninstall the kext driver while in normal mode? Thank you!
3
0
96
1w
Accessory Setup Kit (BLE) not showing multiple options nor the advertising name
I'm developing an application using the accessory setup kit (BLE) on iOS 18+. An important aspect of the connection process is being able to find and choose the correct device. I noticed on iOS 18.2 that I was able to both scroll through the discovered accessories as well as view the advertised name. However, after upgrading to 18.7.2, only a single device is viewable and the advertised name is no longer available. Is there a trigger for this feature that I need to enable or was this "multiple discovery" feature removed? If so, why?
0
1
72
2w
Siri AppIntent phrasing
When my AppShortcut phrase is: "Go (.$direction) with (.applicationName)" Then everything works correctly, the AppIntent correctly receives the parameter. But when my phrase is: "What is my game (.$direction) with (.applicationName)" The an alert dialog pops up saying: "Hey siri what is my game tomorrow with {app name} Do you want me to use ChatGPT to answer that?" The phrase is obviously heard correctly, and it's exactly what I've specified in the AppShortcut. Why isn't it being sent to my AppIntent? import Foundation import AppIntents @available(iOS 17.0, *) enum Direction: String, CaseIterable, AppEnum { case today, yesterday, tomorrow, next static var typeDisplayRepresentation: TypeDisplayRepresentation { TypeDisplayRepresentation(name: "Direction") } static var caseDisplayRepresentations: [Direction: DisplayRepresentation] = [ .today: DisplayRepresentation(title: "today", synonyms: []), .yesterday: DisplayRepresentation(title: "yesterday", synonyms: []), .tomorrow: DisplayRepresentation(title: "tomorrow", synonyms: []), .next: DisplayRepresentation(title: "next", synonyms: []) ] } @available(iOS 17.0, *) struct MoveItemIntent: AppIntent { static var title: LocalizedStringResource = "Move Item" @Parameter(title: "Direction") var direction: Direction func perform() async throws -> some IntentResult { // Logic to move item in the specified direction print("Moving item \(direction)") return .result() } } @available(iOS 17.0, *) final class MyShortcuts: AppShortcutsProvider { static let shortcutTileColor = ShortcutTileColor.navy static var appShortcuts: [AppShortcut] { AppShortcut( intent: MoveItemIntent() , phrases: [ "Go \(\.$direction) with \(.applicationName)" // "What is my game \(\.$direction) with \(.applicationName)" ] , shortTitle: "Test of direction parameter" , systemImageName: "soccerball" ) } }
3
0
207
2w
Mac Catalyst: IOHID InputReportCallback not firing, USBInterfaceOpen returns kIOReturnNotPermitted (0xe00002e2) for custom HID device
Hi everyone, I am developing a .NET MAUI Mac Catalyst app (sandboxed) that communicates with a custom vendor-specific HID USB device. Within the Catalyst app, I am using a native iOS library (built with Objective-C and IOKit) and calling into it via P/Invoke from C#. The HID communication layer relies on IOHIDManager and IOUSBInterface APIs. The device is correctly detected and opened using IOHIDManager APIs. However, IOHIDDeviceRegisterInputReportCallback never triggers — I don’t receive any input reports. To investigate, I also tried using low-level IOKit USB APIs via P/Invoke from my Catalyst app, calling into a native iOS library. When attempting to open the USB interface using IOUSBInterfaceOpen() or IOUSBInterfaceOpenSeize(), both calls fail with: kIOReturnNotPermitted (0xe00002e2). — indicating an access denied error, even though the device enumerates and opens successfully. Interestingly, when I call IOHIDDeviceSetReport(), it returns status = 0, meaning I can successfully send feature reports to the device. Only input reports (via the InputReportCallback) fail to arrive. I’ve confirmed this is not a device issue — the same hardware and protocol work perfectly under Windows using the HIDSharp library, where both input and output reports function correctly. What I’ve verified •Disabling sandboxing doesn’t change the behavior. •The device uses a vendor-specific usage page (not a standard HID like keyboard/mouse). •Enumeration, open, and SetReport all succeed — only reading input reports fails. •Tried polling queues, in queues Input_Misc element failed to add to the queues. •Tried getting report in a loop but no use.
2
0
42
2w
Copying files using Finder and Apple Events
I need my application to copy some files, but using Finder. Now, I know all different methods and options to programmatically copy files using various APIs, but that's not the point here. I specifically need to use Finder for the purpose, so please, let's avoid eventual suggestions mentioning other ways to copy files. My first thought was to use the most simple approach, execute an AppleScript script using NSUserAppleScriptTask, but that turned out not to be ideal. It works fine, unless there already are files with same names at the copying destination. In such case, either the script execution ends with an error, reporting already existing files at the destination, or the existing files can be simply overridden by adding with overwrite option to duplicate command in the script. What I need is behaviour just like when Finder is used from the UI (drag'n'drop, copy/paste…); if there are existing files with same names at the destination, Finder should offer a "resolution panel", asking the user to "stop", "replace", "don't replace", "keep both" or "merge" (the latter in case of conflicting folders). So, I came to suspect that I could achieve such bahaviour by using Apple Events directly and passing kAEAlwaysInteract | kAECanSwitchLayer options to AESendMessage(). However, I can't figure out how to construct appropriate NSAppleEventDescriptor (nor old-style Carbon AppleEvent) objects and instruct Finder to copy files. This is where I came so far, providing srcFiles are source files (to be copied) URLs and dstFolder destination folder (to be copied into) URL: NSRunningApplication *finder = [[NSRunningApplication runningApplicationsWithBundleIdentifier:@"com.apple.finder"] firstObject]; if (!finder) { NSLog(@"Finder is not running."); return; } NSAppleEventDescriptor *finderDescriptor = [NSAppleEventDescriptor descriptorWithBundleIdentifier:[finder bundleIdentifier]]; NSAppleEventDescriptor *dstDescriptor = [NSAppleEventDescriptor descriptorWithString:[dstFolder path]]; NSAppleEventDescriptor *srcDescriptor = [NSAppleEventDescriptor listDescriptor]; for (NSURL *url in srcFiles) { NSAppleEventDescriptor *fileDescriptor = [NSAppleEventDescriptor descriptorWithString:[url path]]; [srcDescriptor insertDescriptor:fileDescriptor atIndex:([srcDescriptor numberOfItems] + 1)]; } NSAppleEventDescriptor *event = [NSAppleEventDescriptor appleEventWithEventClass:kAECoreSuite eventID:kAEClone targetDescriptor:finderDescriptor returnID:kAutoGenerateReturnID transactionID:kAnyTransactionID]; [event setParamDescriptor:srcDescriptor forKeyword:keyDirectObject]; [event setParamDescriptor:dstDescriptor forKeyword:keyAETarget]; NSError *error; NSAppleEventDescriptor *result = [event sendEventWithOptions:(NSAppleEventSendAlwaysInteract | NSAppleEventSendCanSwitchLayer) timeout:10.0 error:&error]; The code above executes without any error. The final result descriptor is a NULL descriptor ([NSAppleEventDescriptor nullDescriptor]) and there's no error returned (by reference). However, nothing happens, Finder remains silent and the application doesn't make macOS/TCC prompt for a permission to "automate Finder". I wonder if the approach above is correct and if I use correct parameters as arguments for all calling method/messages. I'm specially interested if passing keyAETarget is the right value in [event setParamDescriptor:dstDescriptor forKeyword:keyAETarget], since that one looks most suspicious to me. I'd really appreciate if anyone can help me with this. I'd also like to point out that I tried the same approach outlined above with old-style Carbon AppleEvent API, using AECreateDesc(), AECreateAppleEvent(), AEPutParamDesc() and AESendMessage()… All API calls succeeded, returning noErr, but again, nothing happened, Finder remained silent and no macOS/TCC prompt for a permission to "automate Finder". Any help is highly appreciated, thanks! -- Dragan
9
0
139
2w