The outline item of outlineItem(for:) seems to be wrong

Originator:tongzhang101x
Number:rdar://37203575 Date Originated:2018-02-04 06:10:49 +0000
Status:Open Resolved:
Product:PDFKit Product Version:
Classification: Reproducible:Always
 
Area:
PDFKit

Summary:
The outline item of outlineItem(for:) seems to be wrong. 

Steps to Reproduce:
1. Prepare a PDFSelection, currentSelection for example.
2. Get the PDFOutline object for currentSelection.
3. Print label for that outline. 

Example code: 
guard let selection = pdfView.currentSelection else { return } 
guard let outline = pdfView.document?.outlineItem(for: selection) else { return }
print(outline.label)

Expected Results:
outline.label returns the label of the outline for selection. 

Actual Results:
outline.label returns the label of last outline. 

Version/Build:
Tested on Xcode 9.2 (9C40b) and Xcode 9.3 beta (9Q98q).
Bug occurs on iOS 11.2 or later.

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!