MSMessage Layout returns nil, despite being visibly set

Originator:crsven
Number:rdar://27415409 Date Originated:07/18/2016
Status:Open Resolved:
Product:Developer Tools Product Version:Beta 3
Classification: Reproducible:Always
 
In XCode 8 Beta 2 and Beta 3, attempting to access the "layout" property of a MSMessage returns nil, despite the layout being visible in the conversation. I have attached a very minimal sample case that sends a message and, when the message is selected, tries to access the layout and print its caption. Line 37, where the layout is accessed and downcast, will always fail. Debugging shows the layout is nil.

Steps to Reproduce:
1. Install XCode
2. Download and open the attached XCode project
3. Run the sample app in XCode Beta 2 or Beta 3 in the iPhone SE simulator.
4. Open the messages and and select the NilLayoutExample messages app
5. Click the "Send Message" button and send the queued message.
6. Switch to the recipient user.
7. Click on the message that was just sent

Expected Results:
I expected the NilLayoutExample app to open, showing a single button labeled "Send Message". In XCode, I expected to see output from the device with the text: "message caption: A composition caption"

Actual Results:
An error is thrown in XCode: "fatal error: unexpectedly found nil while unwrapping an Optional value"

Version:
Xcode Version 8.0 beta 3 (8S174q)
OS X 10.11.5 (15F34)

Notes:


Configuration:
OS X 10.11.5 (15F34)
Macbook Pro (Retina, 13-ince, Mid 2014)
3 GHHz Intel Core i7
16 GB 1600 Mhz DDR3

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!