Accessing property expirationDate of NSUserActivity class causes a crash

Originator:kraina
Number:rdar://30972918 Date Originated:10-Mar-2017 05:03 PM
Status:Open Resolved:
Product:iOS SDK Product Version:iOS 10.2
Classification: Reproducible:yes
 
Property `expirationDate` of `NSUserActivity` class is bridged as non-optional `Date` in Swift 3.0 (Xcode 8.2). Reading the property makes the app crash.

From NSUserActivity header:

    /* If non-nil, then an absolute date after which this activity is no longer eligible to be indexed or handed off. */
    @available(iOS 9.0, *)
    open var expirationDate: Date


Steps to reproduce:
1. Create an NSUserActivity object
2. print(userActivity.expirationDate)

Expected results:
Prints out the value of expirationDate property

Actual results:
Crash - EXC_BAD_INSTRUCTION (code=EXC_i#*^_INVOP, subcode=0x0)


MacBook Pro 15"  Mid 2015
Xcode 8.2, iOS SDK 10.2, Swift 3.0

Comments

Fixed in iOS 11 / Xcode 9 beta 4

From the header:

/ If non-nil, then an absolute date after which this activity is no longer eligible to be indexed or handed off. /

@available(iOS 9.0, *)
open var expirationDate: Date?
By tomas.kraina at Aug. 1, 2017, 6:08 a.m. (reply...)

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!