Runtime exception if first property is non-objc type

Originator:marcus.kida
Number:rdar://25382670 Date Originated:03/28/2016
Status:Open Resolved:
Product:iOS SDK Product Version:9.3
Classification:Serious Bug Reproducible:Always
 
Summary:
I've got a Swift project which uses Cocoapods and has a few Cocoapods Objective-C dependencies. The rest is pure Swift.

I'm using Xcode 7.3 (7D175) on iPhone 6s Plus (iOS 9.3) or the iPhone 6s 6.3 simulator. It's reproducible on both systems.

Steps to Reproduce:
To reproduce the issue please checkout this repository (github public):
https://github.com/relayable/rel-client-ios

Now switch to this revision:

git checkout b4524344cf2502cb986d9137263439b2bfbd993a

Then try to build it using the Xcode mentioned above and run it on an iPhone 6s 9.3 simulator. You'll see a EXC_BAD_ACCESS exception be thrown at start

Now checkout this revision:

git checkout 52180f484abd3a5642d3458c2240996baeec7571

You'll see that the app start correctly.
If you take a look at the diff you'll notice that `KeychainModel` is the first property in `RESTClient` and it crashes on runtime while it's a struct, now the second commit makes it an NSObject which lints the crash. 

The bug can be reproduced (and linted) by going back to the first revision above, then adding an arbitrary property, e.g.:

let iAmUseless = ""

as a first property in `RESTClient`, then the app also starts fine.


Expected Results:
The app starts independently of the first property's type.

Actual Results:
The app throws a runtime exception if a classes first property is of non-Objective-C type.

Version:
iOS 9.3

Notes:


Configuration:
iPhone 6s, Xcode 7.3 [7D175]

Attachments:
relayable  29-03-2016, 7-54 AM.crash

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!