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

Apple, Jun 6, 2019 at 12:34 AM

We believe this issue is resolved.

Please test this issue with the latest iOS 13 beta release and update your bug report at https://bugreport.apple.com/ with your results.

iOS betas: https://developer.apple.com/download/

If the issue continues, please update any logs: https://developer.apple.com/bug-reporting/profiles-and-logs/

Has this issue been fixed for you?

By tongzhang101x at Sept. 29, 2019, 3:58 a.m. (reply...)

This issue has still not been resolved. I also experience this bug.

document.outlineItem(for:) still returns the last outline item on the page instead of the outline which the selection falls under. If there is only 1 outline item on the page which the selection falls in, it will return the correct outline item (there is only 1 option). But if there are multiple outline items on a single page, the method will always return the one closest to the bottom of the page, regardless of where the selection is.

I am running iOS 14.1 with XCode 12.0.1


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!