Requesting data for a PHAssetResource fails at 50%

Originator:acjensen
Number:rdar://30584196 Date Originated:2/17/2017
Status:Duplicate of 29408391 Resolved:
Product:iOS Product Version:10.2.1
Classification:Photos Framework Reproducible:Always
 
Summary:
When requesting data for a PHAssetResource, the request fails at 50% and reports the following error:

2017-02-17 16:20:23.649561 MyApp[12063:5383858] Error: Unable to locate resource <PHInternalAssetResource: 0x1702f1b80> type=video size={1920, 1080} fileSize=43806718 uti=com.apple.quicktime-movie filename=IMG_2972.MOV assetLocalIdentifier=60A58560-728D-4DC3-83C5-4C75D27C2421/L0/001

If I immediately retry the same request, it succeeds. The "download" is also much faster the second time, suggesting that the asset is indeed getting fetched and cached despite the reported failure.

Steps to Reproduce:
1) Request data for a PHAssetResource using PHAssetResourceManager.requestData(for: resource, options: options, dataReceivedHandler: {...}, completion: {...}).

Expected Results:
Data for the resource is fetched, and the completion handler returns a nil error.

Actual Results:
When the request's progress reaches 50%, the completion handler is called with the following error:

Error Domain=NSCocoaErrorDomain Code=-1 "(null)"

The "Unable to locate resource" error given above is shown in the Xcode console.

Version:
iOS 10.2.1 (14D27)

Notes:
The same behavior can be seen when using PHAssetResourceManager.writeData(for: assetResource, ...).

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!