NSUserActivity.expirationDate defined as NSDate, Should be NSDate?
| Originator: | lordandrei | ||
| Number: | rdar://31937237 | Date Originated: | 02-May-2017 10:54 AM |
| Status: | Open | Resolved: | |
| Product: | iOS SDK | Product Version: | SDK: 10.3 |
| Classification: | Crash | Reproducible: | Under circumstances |
Summary:
Value for expirationDate can return nil but type is not defined as optional in API for NSUserActivity
When value is nil, there is a crash.
Can not nil check because type is not defined to allow nil check
Steps to Reproduce:
Function to test: (in appDelegate)
application(_ application: UIApplication,
continue userActivity: NSUserActivity,
restorationHandler: @escaping ([Any]?) -> Void) -> Bool
1. Cause an app to be opened by: function noted above
2. Assure cause will have nil expiration date (I used a simple weblink, associated through an associated domain)
3. In function: print("crash here: \(userActivity.expirationDate)
Expected Results:
NSUser Activity definition in SDK:
/* 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
So.. if the non optional isn't nil we're okay. but if the non-option is nil...
Actual Results:
Crash
Attempt to p or po userActivity.expirationDate:
error: Execution was interrupted, reason: EXC_BREAKPOINT (code=1, subcode=0x1026683d0).
The process has been returned to the state before expression evaluation.
Version:
Phone: iOS 10.3.2 (14F5089a) ,Simulator: 10.3 (14E269)
Notes:
Xcode 8.3.2 (8E2002); Reproduces always
SDK: 10.3
Problem is reentry of closed issue: 29024139
Configuration:
iPhone 7+, Simulator
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!
This seems to be fixed in iOS 11 / Xcode 9 beta 4
More info: https://openradar.appspot.com/30972918