Post

Replies

Boosts

Views

Activity

Reply to Detect SD Card
This is as far as I have got with ImageCaptureCore - attempting the simplest possible case to detect the card - running on an iPhone from Xcode it crashes. I have also tried with the ICDeviceBrowserDelegate directly on the DeviceProbe class but get the same result. import Foundation import ImageCaptureCore @objcMembers final class CameraBrowserDelegate: NSObject, ICDeviceBrowserDelegate { func deviceBrowser(_ browser: ICDeviceBrowser, didAdd device: ICDevice, moreComing: Bool) { print("Did add device: \(device)") } func deviceBrowser(_ browser: ICDeviceBrowser, didRemove device: ICDevice, moreGoing: Bool) { print("Did remove device: \(device)") } } final class DeviceProbe: NSObject { private let browser = ICDeviceBrowser() private let delegate = CameraBrowserDelegate() override init() { super.init() browser.delegate = delegate browser.browsedDeviceTypeMask = ICDeviceTypeMask( rawValue: ICDeviceTypeMask.camera.rawValue )! print("Starting device browser...") browser.start() // <-- crash occurs here } }
Topic: App & System Services SubTopic: Core OS Tags:
May ’26
Reply to Detect SD Card
Thanks very much for the response. Yes I considered using the ImageCapture framework but it seems to be designed for communicating with cameras and scanners rather than SD card readers. Is this incorrect? Does the Photos app use the ImageCapture framework for importing images from USB attached SD cards?
Topic: App & System Services SubTopic: Core OS Tags:
May ’26
Reply to Cross process URL bookmark
Before I get too far into inter process communication I've been testing the concept of passing file descriptors using XPC by using an XPC Service (this should allow me to debug the XPC communication syntax). Is it sufficient to pass a FileHandle? Passing a FileHandle is straightforward and works well with the XPC Service but would it work across processes or do I need to find some way of passing a raw file descriptor? Passing raw file descriptors seems much more complex - especially in a pure Swift application. I tried passing UnsafeMutablePointer but that failed and crashed the application.
Jun ’25
Reply to Cross process URL bookmark
Thanks a lot - I will give this a try - it is not a problem for all the clients to share the same app group and be published by the same team. I have done something similar using an XPC service with a single client but that seems much more straightforward to implement. Generating the named XPC endpoint from a Swift app appears more complicated and tutorials/examples hard to find. ChatGPT points me to using launchctl from the command line to register a MachServices name but this would make it complicated to distribute the application.
May ’25
Reply to Detect SD Card
This is as far as I have got with ImageCaptureCore - attempting the simplest possible case to detect the card - running on an iPhone from Xcode it crashes. I have also tried with the ICDeviceBrowserDelegate directly on the DeviceProbe class but get the same result. import Foundation import ImageCaptureCore @objcMembers final class CameraBrowserDelegate: NSObject, ICDeviceBrowserDelegate { func deviceBrowser(_ browser: ICDeviceBrowser, didAdd device: ICDevice, moreComing: Bool) { print("Did add device: \(device)") } func deviceBrowser(_ browser: ICDeviceBrowser, didRemove device: ICDevice, moreGoing: Bool) { print("Did remove device: \(device)") } } final class DeviceProbe: NSObject { private let browser = ICDeviceBrowser() private let delegate = CameraBrowserDelegate() override init() { super.init() browser.delegate = delegate browser.browsedDeviceTypeMask = ICDeviceTypeMask( rawValue: ICDeviceTypeMask.camera.rawValue )! print("Starting device browser...") browser.start() // <-- crash occurs here } }
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
May ’26
Reply to Detect SD Card
Thanks very much for the response. Yes I considered using the ImageCapture framework but it seems to be designed for communicating with cameras and scanners rather than SD card readers. Is this incorrect? Does the Photos app use the ImageCapture framework for importing images from USB attached SD cards?
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
May ’26
Reply to Cross process URL bookmark
Before I get too far into inter process communication I've been testing the concept of passing file descriptors using XPC by using an XPC Service (this should allow me to debug the XPC communication syntax). Is it sufficient to pass a FileHandle? Passing a FileHandle is straightforward and works well with the XPC Service but would it work across processes or do I need to find some way of passing a raw file descriptor? Passing raw file descriptors seems much more complex - especially in a pure Swift application. I tried passing UnsafeMutablePointer but that failed and crashed the application.
Replies
Boosts
Views
Activity
Jun ’25
Reply to Cross process URL bookmark
Thanks a lot - I will give this a try - it is not a problem for all the clients to share the same app group and be published by the same team. I have done something similar using an XPC service with a single client but that seems much more straightforward to implement. Generating the named XPC endpoint from a Swift app appears more complicated and tutorials/examples hard to find. ChatGPT points me to using launchctl from the command line to register a MachServices name but this would make it complicated to distribute the application.
Replies
Boosts
Views
Activity
May ’25