ImageCaptureCore: PTPNotAuthorizedToSendCommand upon making PTP request

Number:rdar://FB7593726 Date Originated:2020-02-21
Status:Closed Resolved:Resolved!
Product:Image I/O Product Version:iPadOS 13.4 Beta 2
Classification: Reproducible:100%
This worked in iPadOS13.4 Beta 1. No longer works in iOS 13.4 Beta 2.

I'm developing a third party app which uses ImageCaptureCore on iPadOS to control a DSLR. For astrophotography.

The rough steps, and there is an attached code sample that reproduces this.

- Instantiate an ICDeviceBrowser, set it's delegate and tell it start browser.
- Tap "OK" at the permission prompt.
- Device Browser's delegate is called after it finds my connected DSLR (`deviceBrowser(_:didAdd:moreComing:)`).
- I then set that added ICCameraDevice's delegate and request that the camera device open a session.
- After ImageCaptureCore finishes indexing the files on my DSLR (after `deviceDidBecomeReady(withCompleteContentCatalog:)` is called on my `ICCameraDeviceDelegate`) [1], I make a PTP request.
- The completion for `ICCameraDevice.requestSendPTPCommand(_:outData:completion:)` is then called with empty data, empty data, and a non-nil error with domain "" and code -21249. Looking through the documentation, I see that that corresponds to a PTP unauthorized error.

I also set breakpoints (in the sample project, I have print statements there) at `cameraDeviceDidRemoveAccessRestriction(_:)` and `cameraDeviceDidEnableAccessRestriction(_:)`, in case maybe those ever get called (despite the documentation indicating that they're only for Apple cameras), but I never got a callback for them.

[1]: In iPadOS/iOS 13.4 beta 1, I learned that unlike the macOS version of ImageCaptureCore, you need to wait until `deviceDidBecomeReady(withCompleteContentCatalog:)` is called on your `ICCamereDeviceDelegate` before you can make PTP requests. In the macOS version of ImageCaptureCore, you can start making PTP requests as soon as `device(_:didOpenSessionWithError:)` is called.

For openradar: The minimum code sample to reproduce this is at


Edit/Update: To get this to work, you need to add a value for `NSCameraUsageDescription` to your info.plist.


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!