I have following function in a swift file. I am calling this from Obj C file with NSDate in place of startDate. And quite often, not every time, my app crashes with
Date._unconditionallyBridgeFromObjectiveC(NSDate?)
How can I fix this?
func trackMeetingEnded(_ name: String, startDate: Date, backgroundTime: TimeInterval) {}
Stack trace
Crashed: com.apple.main-thread
0 libswiftFoundation.dylib 0x102061e98 static Date._unconditionallyBridgeFromObjectiveC(NSDate?) -> Date + 72
1 Acid 0x10017ece4 @objc static ClusteredMixpanel.trackMeetingEnded(String, startDate : Date, backgroundTime : Double) -> () (MixpanelMeeting.swift)
2 Acid 0x10073e1bc __56-[MeetingLifeCycleViewController stateInitialization]_block_invoke.221 (MeetingLifeCycleViewController.m:267)
3 Acid 0x1001ee5c4 partial apply for thunk (StateMachine.swift)
4 Acid 0x1001ea70c specialized State.willLeaveState(State) -> () (StateMachine.swift:238)
5 Acid 0x1001ead90 specialized StateMachine.transitionToState(State) -> Bool (StateMachine.swift)
6 Acid 0x1001e1f18 @objc StateMachine.transitionToState(State) -> Bool (StateMachine.swift)
7 Acid 0x10073ace0 -[MeetingLifeCycleViewController dismissCall] (MeetingLifeCycleViewController.m:538)
8 Acid 0x10086d648 -[InMeetingViewController hangup] (InMeetingViewController.m:531)
enter code here
I believe NSDate to Date conversion is done by OS in this case. The issue is seen only after migration to Swift 3. Are there any known issues around this? I could not find anything online :(