parsing attributed strings on iOS 7 breaks when there are newlines present

Originator:hello
Number:rdar://14759024 Date Originated:8/16/2013
Status: Resolved:
Product:iOS 7 Product Version:7.0 11A4449d
Classification:Serious Reproducible:Always
 
Summary:

* Compile against the iOS 6 SDK
* Use

- (void)enumerateAttributesInRange:(NSRange)enumerationRange options:(NSAttributedStringEnumerationOptions)opts usingBlock:(void (^)(NSDictionary *attrs, NSRange range, BOOL *stop))block

to parse an attributed string
* If the string has newlines in it you'll start getting ranges that have incorrect starting positions

Steps to Reproduce:

* Open the attached project in Xcode 4.6.3
* Run the app on an iOS 7 device

The app has two UITextViews. The first one has text that's stored in the XIB. The second has text generated in code. Each one is parsed for white-on-black text and the resulting string in placed in the text field below it.

Each method reproduces the bug.

If you add a space before the newline (and change the range) in the code-generated string you'll get the expected result.

Expected Results:

I would expect attributed strings to be parsed correctly wether or not they contain newlines.

Actual Results:

Attributed string aren't parsed correctly on iOS7 devices.

Regression:

I think this was introduced in iOS 7 b5.

Notes:

Sample project at http://cl.ly/QrPN

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!