NSFileWrapper fails to write attached files on iOS 9 for HTML

Originator:greg
Number:rdar://21737761 Date Originated:08-Jul-2015
Status:Open Resolved:
Product:iOS Product Version:9.0 / 13A4293g
Classification:Serious Bug Reproducible:Always
 
NSFileWrapper fails to write attached files on iOS 9 for HTML

Assuming you have an NSAttributedString with attached files (for example, a signature image), if you call [NSAttributedString fileWrapperForRange:documentAttributes:@{NSDocumentTypeDocumentAttribute:NSHTMLTextDocumentType} error:] then call [NSFileWrapper writeToURL:options:originalContentsURL:error:], the resulting folder will only contain the index.html file and not the images on iOS 9. The same code on OS X will include the images, as expected.

To reproduce:
1. Using El Capitan Beta 3 (15A216g)
2. Launch Xcode 7.0 Beta 3 (7A152u)
3. Open the attached RTFDWithAttachments.xcworkspace file (unzip first)

http://smilesoftware.com/downloads/RTFDWithAttachments.zip

4. Select the RTFD-iOS project, and run it on the iPhone 6 simulator

The console will list the files enumerated by the HTML wrapper.
Expected:
index.html and signature2.gif images are shown
Actual:
index.html only is shown

5. Select the RTFD-iOS project, and run it on the device (in my case, a 5th gen. iPod touch)

The console will list the files enumerated by the HTML wrapper.
Expected:
index.html and signature2.gif images are shown
Actual:
index.html only is shown

6. Select the RTFD-OSX project, and run it

The console will list the files enumerated by the HTML wrapper.
Expected:
index.html and signature2.gif images are shown
Actual:
Matches expected.

We expect that for an HTML document containing an image, both the signature image and index.html will be written.

On the Simulator and on iOS, writing the NSFileWrapper for an HTML document containing a signature image only writes index.html.

On OS X, writing the NSFileWrapper for an HTML document containing a signature image writes both the signature image and index.html, as one would expect.

iMac (24-inch, Early 2008) and iPod touch 5th Generation

OS X 10.11 (15A216g) and iOS 9 (13A4293g)

See my results in attached RTFD Results.rtf document:

http://smilesoftware.com/downloads/RTFD_Results.rtf

The common code is found in the WrapperBugDemo class. It produces different results on OS X and iOS.

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!