ImageCaptureCore via Mac Catalyst: ICCameraFile requestReadData(atOffset:length:completion:) always passes nil Data object to completion block

Originator:mjrusso
Number:rdar://FB7663990 Date Originated:2020-04-14
Status:Open Resolved:
Product:Image I/O Product Version:macOS 10.15.4
Classification: Reproducible:100%
 
(Note that this ticket refers specifically to `requestReadData(atOffset:length:completion:)` on Catalyst. See FB7663947 for the related iPadOS ticket. To my knowledge, `requestReadData(atOffset:length:completion:)` has never worked on Catalyst, unlike iPadOS, where it has worked until iPadOS 13.4.)

On Mac Catalyst, ICCameraFile's `requestReadData(atOffset:length:completion:)` method does not read data from the camera file.

When `requestReadData` is called with an offset of 0 and a length corresponding to the size of the file, the completion block is executed with a nil Data object. (The error is also nil.) The expected result is a Data object with the actual contents of the camera file (and a nil error).

The attached project reproduces this sample issue. (There is no app UI; see the messages logged to the console.) This project:

- Instantiates an ICDeviceBrowser, sets its delegate, and starts its browser.
- When an ICCameraDevice (such as an SD card) is connected, the code automatically sets its delegate, and opens a session.
- When the ICCameraDeviceDelegate's `deviceDidBecomeReady(withCompleteContentCatalog:)` delegate method is called, `requestReadData(atOffset:length:completion:)` is called with on the first ICCameraFile object. (Using the first ICCameraFile is arbitrary; the results are the same regardless of which file is chosen.)
- The `requestReadData(atOffset:length:completion:)` completion block is subsequently called with a nil Data object, and a nil Error object.

For Open Radar: The minimum code sample to reproduce this is at https://gist.github.com/mjrusso/b223bf8db93e64d858e80b6fb8ab6ef8

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com 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!