Jumhyn
(Frederick Kellison-Linn)
1
I have an Objective-C class which contains an NSDate *createdTime property. When using an object of this class from Swift, accessing createdTime and assigning it to a variable of type Date results in nil being assigned to the variable. This behavior can also be seen in LLDB, where p createdTime prints nil but po createdTime prints the date:
(lldb) p obj.createdTime
(Date?) $R60 = nil
(lldb) po obj.createdTime
▿ Optional<Date>
▿ some : 2015-04-07 14:05:29 +0000
- timeIntervalSinceReferenceDate : 450108329.0
(lldb) p (obj.createdTime as NSDate?)
(NSDate?) $R66 = some {
some = 0x803059aa219d0795 2015-04-07 14:05:29 UTC
}
(lldb) p (obj.createdTime as NSDate?) as Date?
(Date?) $R68 = nil
What is going on?
Jumhyn
(Frederick Kellison-Linn)
3
Thanks @harlanhaskins. That looks like exactly the issue I'm hitting!
See also [SR-12444] Xcode Debugger and lldb fail to display Foundation Types · Issue #4428 · apple/llvm-project · GitHub
When I filed a similar radar with apple it said at the top of the screen that similar bugs had been reported "more than ten times."
1 Like